diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/History.stories.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/History.stories.tsx | 257 |
1 files changed, 138 insertions, 119 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/History.stories.tsx b/packages/taler-wallet-webextension/src/wallet/History.stories.tsx index c28e4188f..482b8d698 100644 --- a/packages/taler-wallet-webextension/src/wallet/History.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/History.stories.tsx @@ -49,17 +49,17 @@ export default { let count = 0; const commonTransaction = (): TransactionCommon => -({ - amountRaw: "USD:10", - amountEffective: "USD:9", - txState: { - major: TransactionMajorState.Done, - }, - timestamp: TalerProtocolTimestamp.fromSeconds( - new Date().getTime() / 1000 - count++ * 60 * 60 * 7, - ), - transactionId: String(count), -} as TransactionCommon); + ({ + amountRaw: "USD:10", + amountEffective: "USD:9", + txState: { + major: TransactionMajorState.Done, + }, + timestamp: TalerProtocolTimestamp.fromSeconds( + new Date().getTime() / 1000 - count++ * 60 * 60 * 7, + ), + transactionId: String(count), + }) as TransactionCommon; const exampleData = { withdraw: { @@ -165,7 +165,9 @@ const exampleData = { export const SomeBalanceWithNoTransactions = tests.createExample( TestedComponent, { - transactions: [], + transactionsByDate: { + "11/11/11": [], + }, balances: [ { available: "TESTKUDOS:10" as AmountString, @@ -186,7 +188,9 @@ export const SomeBalanceWithNoTransactions = tests.createExample( ); export const OneSimpleTransaction = tests.createExample(TestedComponent, { - transactions: [exampleData.withdraw], + transactionsByDate: { + "11/11/11": [exampleData.withdraw], + }, balances: [ { flags: [], @@ -203,13 +207,14 @@ export const OneSimpleTransaction = tests.createExample(TestedComponent, { }, ], balanceIndex: 0, - }); export const TwoTransactionsAndZeroBalance = tests.createExample( TestedComponent, { - transactions: [exampleData.withdraw, exampleData.deposit], + transactionsByDate: { + "11/11/11": [exampleData.withdraw, exampleData.deposit], + }, balances: [ { flags: [], @@ -230,14 +235,16 @@ export const TwoTransactionsAndZeroBalance = tests.createExample( ); export const OneTransactionPending = tests.createExample(TestedComponent, { - transactions: [ - { - ...exampleData.withdraw, - txState: { - major: TransactionMajorState.Pending, + transactionsByDate: { + "11/11/11": [ + { + ...exampleData.withdraw, + txState: { + major: TransactionMajorState.Pending, + }, }, - }, - ], + ], + }, balances: [ { flags: [], @@ -257,22 +264,24 @@ export const OneTransactionPending = tests.createExample(TestedComponent, { }); export const SomeTransactions = tests.createExample(TestedComponent, { - transactions: [ - exampleData.withdraw, - exampleData.payment, - exampleData.withdraw, - exampleData.payment, - { - ...exampleData.payment, - info: { - ...exampleData.payment.info, - summary: - "this is a long summary that may be cropped because its too long", + transactionsByDate: { + "11/11/11": [ + exampleData.withdraw, + exampleData.payment, + exampleData.withdraw, + exampleData.payment, + { + ...exampleData.payment, + info: { + ...exampleData.payment.info, + summary: + "this is a long summary that may be cropped because its too long", + }, }, - }, - exampleData.refund, - exampleData.deposit, - ], + exampleData.refund, + exampleData.deposit, + ], + }, balances: [ { flags: [], @@ -294,79 +303,81 @@ export const SomeTransactions = tests.createExample(TestedComponent, { export const SomeTransactionsInDifferentStates = tests.createExample( TestedComponent, { - transactions: [ - exampleData.withdraw, - { - ...exampleData.withdraw, - exchangeBaseUrl: "https://aborted/withdrawal", - txState: { - major: TransactionMajorState.Aborted, + transactionsByDate: { + "11/11/11": [ + exampleData.withdraw, + { + ...exampleData.withdraw, + exchangeBaseUrl: "https://aborted/withdrawal", + txState: { + major: TransactionMajorState.Aborted, + }, }, - }, - { - ...exampleData.withdraw, - exchangeBaseUrl: "https://pending/withdrawal", - txState: { - major: TransactionMajorState.Pending, + { + ...exampleData.withdraw, + exchangeBaseUrl: "https://pending/withdrawal", + txState: { + major: TransactionMajorState.Pending, + }, }, - }, - { - ...exampleData.withdraw, - exchangeBaseUrl: "https://failed/withdrawal", - txState: { - major: TransactionMajorState.Failed, + { + ...exampleData.withdraw, + exchangeBaseUrl: "https://failed/withdrawal", + txState: { + major: TransactionMajorState.Failed, + }, }, - }, - { - ...exampleData.payment, - info: { - ...exampleData.payment.info, - summary: "normal payment", - }, - }, - { - ...exampleData.payment, - info: { - ...exampleData.payment.info, - summary: "aborting in progress", - }, - txState: { - major: TransactionMajorState.Aborting, - }, - }, - { - ...exampleData.payment, - info: { - ...exampleData.payment.info, - summary: "aborted payment", + { + ...exampleData.payment, + info: { + ...exampleData.payment.info, + summary: "normal payment", + }, }, - txState: { - major: TransactionMajorState.Aborted, - }, - }, - { - ...exampleData.payment, - info: { - ...exampleData.payment.info, - summary: "pending payment", + { + ...exampleData.payment, + info: { + ...exampleData.payment.info, + summary: "aborting in progress", + }, + txState: { + major: TransactionMajorState.Aborting, + }, }, - txState: { - major: TransactionMajorState.Pending, + { + ...exampleData.payment, + info: { + ...exampleData.payment.info, + summary: "aborted payment", + }, + txState: { + major: TransactionMajorState.Aborted, + }, }, - }, - { - ...exampleData.payment, - info: { - ...exampleData.payment.info, - summary: "failed payment", + { + ...exampleData.payment, + info: { + ...exampleData.payment.info, + summary: "pending payment", + }, + txState: { + major: TransactionMajorState.Pending, + }, }, - txState: { - major: TransactionMajorState.Failed, + { + ...exampleData.payment, + info: { + ...exampleData.payment.info, + summary: "failed payment", + }, + txState: { + major: TransactionMajorState.Failed, + }, }, - }, - exampleData.refund, - exampleData.deposit, - ], + exampleData.refund, + exampleData.deposit, + ], + }, balances: [ { flags: [], @@ -389,15 +400,17 @@ export const SomeTransactionsInDifferentStates = tests.createExample( export const SomeTransactionsWithTwoCurrencies = tests.createExample( TestedComponent, { - transactions: [ - exampleData.withdraw, - exampleData.payment, - exampleData.withdraw, - exampleData.payment, - exampleData.refresh, - exampleData.refund, - exampleData.deposit, - ], + transactionsByDate: { + "11/11/11": [ + exampleData.withdraw, + exampleData.payment, + exampleData.withdraw, + exampleData.payment, + exampleData.refresh, + exampleData.refund, + exampleData.deposit, + ], + }, balances: [ { flags: [], @@ -431,7 +444,9 @@ export const SomeTransactionsWithTwoCurrencies = tests.createExample( ); export const FiveOfficialCurrencies = tests.createExample(TestedComponent, { - transactions: [exampleData.withdraw], + transactionsByDate: { + "11/11/11": [exampleData.withdraw], + }, balances: [ { flags: [], @@ -505,7 +520,9 @@ export const FiveOfficialCurrencies = tests.createExample(TestedComponent, { export const FiveOfficialCurrenciesWithHighValue = tests.createExample( TestedComponent, { - transactions: [exampleData.withdraw], + transactionsByDate: { + "11/11/11": [exampleData.withdraw], + }, balances: [ { flags: [], @@ -578,12 +595,14 @@ export const FiveOfficialCurrenciesWithHighValue = tests.createExample( ); export const PeerToPeer = tests.createExample(TestedComponent, { - transactions: [ - exampleData.pull_credit, - exampleData.pull_debit, - exampleData.push_credit, - exampleData.push_debit, - ], + transactionsByDate: { + "11/11/11": [ + exampleData.pull_credit, + exampleData.pull_debit, + exampleData.push_credit, + exampleData.push_debit, + ], + }, balances: [ { flags: [], |