aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-01-09 20:20:09 -0300
committerSebastian <sebasjm@gmail.com>2023-01-09 20:20:09 -0300
commit4a781bd0dd8828ce152f6ab2c3f1bbd6b5e826f7 (patch)
tree5c16976f99eb973ff62d78ed64107ca01df57b99 /packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx
parent8a70edb2f8e235c3462127b0aa4e1b65aa1aee0b (diff)
downloadwallet-core-4a781bd0dd8828ce152f6ab2c3f1bbd6b5e826f7.tar.xz
fix #7153: more error handling
if handler do not trap error then fail at compile time, all safe handlers push alert on error errors are typed so they render good information
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx')
-rw-r--r--packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx147
1 files changed, 77 insertions, 70 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx
index 868d3b0e6..bc941c9af 100644
--- a/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx
@@ -39,11 +39,13 @@ import {
WithdrawalType,
} from "@gnu-taler/taler-util";
import { DevContextProviderForTesting } from "../context/devContext.js";
-import {
- createExample,
- createExampleWithCustomContext as createExampleInCustomContext,
-} from "../test-utils.js";
+// import {
+// createExample,
+// createExampleWithCustomContext as createExampleInCustomContext,
+// } from "../test-utils.js";
import { TransactionView as TestedComponent } from "./Transaction.js";
+import { tests } from "@gnu-taler/web-util/lib/index.browser";
+import beer from "../../static-dev/beer.png";
export default {
title: "transaction details",
@@ -214,24 +216,28 @@ const transactionError = {
hint: "The payment is too late, the offer has expired.",
},
},
+ when: new Date().toISOString(),
hint: "Error: WALLET_UNEXPECTED_REQUEST_ERROR",
message: "Unexpected error code in response",
};
-export const Withdraw = createExample(TestedComponent, {
+export const Withdraw = tests.createExample(TestedComponent, {
transaction: exampleData.withdraw,
});
-export const WithdrawFiveMinutesAgo = createExample(TestedComponent, () => ({
- transaction: {
- ...exampleData.withdraw,
- timestamp: TalerProtocolTimestamp.fromSeconds(
- new Date().getTime() / 1000 - 60 * 5,
- ),
- },
-}));
+export const WithdrawFiveMinutesAgo = tests.createExample(
+ TestedComponent,
+ () => ({
+ transaction: {
+ ...exampleData.withdraw,
+ timestamp: TalerProtocolTimestamp.fromSeconds(
+ new Date().getTime() / 1000 - 60 * 5,
+ ),
+ },
+ }),
+);
-export const WithdrawFiveMinutesAgoAndPending = createExample(
+export const WithdrawFiveMinutesAgoAndPending = tests.createExample(
TestedComponent,
() => ({
transaction: {
@@ -244,38 +250,41 @@ export const WithdrawFiveMinutesAgoAndPending = createExample(
}),
);
-export const WithdrawError = createExample(TestedComponent, {
+export const WithdrawError = tests.createExample(TestedComponent, {
transaction: {
...exampleData.withdraw,
error: transactionError,
},
});
-export const WithdrawErrorInDevMode = createExampleInCustomContext(
+// export const WithdrawErrorInDevMode = tests.createExampleInCustomContext(
+// TestedComponent,
+// {
+// transaction: {
+// ...exampleData.withdraw,
+// error: transactionError,
+// },
+// },
+// DevContextProviderForTesting,
+// { value: true },
+// );
+
+export const WithdrawPendingManual = tests.createExample(
TestedComponent,
- {
+ () => ({
transaction: {
...exampleData.withdraw,
- error: transactionError,
+ withdrawalDetails: {
+ type: WithdrawalType.ManualTransfer,
+ exchangePaytoUris: ["payto://iban/ES8877998399652238"],
+ reservePub: "A05AJGMFNSK4Q62NXR2FKNDB1J4EXTYQTE7VA4M9GZQ4TR06YBNG",
+ } as WithdrawalDetails,
+ pending: true,
},
- },
- DevContextProviderForTesting,
- { value: true },
+ }),
);
-export const WithdrawPendingManual = createExample(TestedComponent, () => ({
- transaction: {
- ...exampleData.withdraw,
- withdrawalDetails: {
- type: WithdrawalType.ManualTransfer,
- exchangePaytoUris: ["payto://iban/ES8877998399652238"],
- reservePub: "A05AJGMFNSK4Q62NXR2FKNDB1J4EXTYQTE7VA4M9GZQ4TR06YBNG",
- } as WithdrawalDetails,
- pending: true,
- },
-}));
-
-export const WithdrawPendingTalerBankUnconfirmed = createExample(
+export const WithdrawPendingTalerBankUnconfirmed = tests.createExample(
TestedComponent,
{
transaction: {
@@ -291,7 +300,7 @@ export const WithdrawPendingTalerBankUnconfirmed = createExample(
},
);
-export const WithdrawPendingTalerBankConfirmed = createExample(
+export const WithdrawPendingTalerBankConfirmed = tests.createExample(
TestedComponent,
{
transaction: {
@@ -306,18 +315,18 @@ export const WithdrawPendingTalerBankConfirmed = createExample(
},
);
-export const Payment = createExample(TestedComponent, {
+export const Payment = tests.createExample(TestedComponent, {
transaction: exampleData.payment,
});
-export const PaymentError = createExample(TestedComponent, {
+export const PaymentError = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
error: transactionError,
},
});
-export const PaymentWithRefund = createExample(TestedComponent, {
+export const PaymentWithRefund = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
amountRaw: "KUDOS:12",
@@ -334,7 +343,7 @@ export const PaymentWithRefund = createExample(TestedComponent, {
},
});
-export const PaymentWithDeliveryDate = createExample(TestedComponent, {
+export const PaymentWithDeliveryDate = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
amountRaw: "KUDOS:12",
@@ -347,7 +356,7 @@ export const PaymentWithDeliveryDate = createExample(TestedComponent, {
},
});
-export const PaymentWithDeliveryAddr = createExample(TestedComponent, {
+export const PaymentWithDeliveryAddr = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
amountRaw: "KUDOS:12",
@@ -363,7 +372,7 @@ export const PaymentWithDeliveryAddr = createExample(TestedComponent, {
},
});
-export const PaymentWithDeliveryFull = createExample(TestedComponent, {
+export const PaymentWithDeliveryFull = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
amountRaw: "KUDOS:12",
@@ -382,7 +391,7 @@ export const PaymentWithDeliveryFull = createExample(TestedComponent, {
},
});
-export const PaymentWithRefundPending = createExample(TestedComponent, {
+export const PaymentWithRefundPending = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
amountRaw: "KUDOS:12",
@@ -392,7 +401,7 @@ export const PaymentWithRefundPending = createExample(TestedComponent, {
},
});
-export const PaymentWithFeeAndRefund = createExample(TestedComponent, {
+export const PaymentWithFeeAndRefund = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
amountRaw: "KUDOS:11",
@@ -401,7 +410,7 @@ export const PaymentWithFeeAndRefund = createExample(TestedComponent, {
},
});
-export const PaymentWithFeeAndRefundFee = createExample(TestedComponent, {
+export const PaymentWithFeeAndRefundFee = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
amountRaw: "KUDOS:11",
@@ -410,20 +419,18 @@ export const PaymentWithFeeAndRefundFee = createExample(TestedComponent, {
},
});
-export const PaymentWithoutFee = createExample(TestedComponent, {
+export const PaymentWithoutFee = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
amountRaw: "KUDOS:12",
},
});
-export const PaymentPending = createExample(TestedComponent, {
+export const PaymentPending = tests.createExample(TestedComponent, {
transaction: { ...exampleData.payment, pending: true },
});
-import beer from "../../static-dev/beer.png";
-
-export const PaymentWithProducts = createExample(TestedComponent, {
+export const PaymentWithProducts = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
info: {
@@ -460,7 +467,7 @@ export const PaymentWithProducts = createExample(TestedComponent, {
} as TransactionPayment,
});
-export const PaymentWithLongSummary = createExample(TestedComponent, {
+export const PaymentWithLongSummary = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
info: {
@@ -484,16 +491,16 @@ export const PaymentWithLongSummary = createExample(TestedComponent, {
} as TransactionPayment,
});
-export const Deposit = createExample(TestedComponent, {
+export const Deposit = tests.createExample(TestedComponent, {
transaction: exampleData.deposit,
});
-export const DepositTalerBank = createExample(TestedComponent, {
+export const DepositTalerBank = tests.createExample(TestedComponent, {
transaction: {
...exampleData.deposit,
targetPaytoUri: "payto://x-taler-bank/bank.demo.taler.net/Exchange",
},
});
-export const DepositBitcoin = createExample(TestedComponent, {
+export const DepositBitcoin = tests.createExample(TestedComponent, {
transaction: {
...exampleData.deposit,
amountRaw: "BITCOINBTC:0.0000011",
@@ -502,88 +509,88 @@ export const DepositBitcoin = createExample(TestedComponent, {
"payto://bitcoin/bcrt1q6ps8qs6v8tkqrnru4xqqqa6rfwcx5ufpdfqht4?amount=BTC:0.1&subject=0ZSX8SH0M30KHX8K3Y1DAMVGDQV82XEF9DG1HC4QMQ3QWYT4AF00",
},
});
-export const DepositIBAN = createExample(TestedComponent, {
+export const DepositIBAN = tests.createExample(TestedComponent, {
transaction: {
...exampleData.deposit,
targetPaytoUri: "payto://iban/ES8877998399652238",
},
});
-export const DepositError = createExample(TestedComponent, {
+export const DepositError = tests.createExample(TestedComponent, {
transaction: {
...exampleData.deposit,
error: transactionError,
},
});
-export const DepositPending = createExample(TestedComponent, {
+export const DepositPending = tests.createExample(TestedComponent, {
transaction: { ...exampleData.deposit, pending: true },
});
-export const Refresh = createExample(TestedComponent, {
+export const Refresh = tests.createExample(TestedComponent, {
transaction: exampleData.refresh,
});
-export const RefreshError = createExample(TestedComponent, {
+export const RefreshError = tests.createExample(TestedComponent, {
transaction: {
...exampleData.refresh,
error: transactionError,
},
});
-export const Tip = createExample(TestedComponent, {
+export const Tip = tests.createExample(TestedComponent, {
transaction: exampleData.tip,
});
-export const TipError = createExample(TestedComponent, {
+export const TipError = tests.createExample(TestedComponent, {
transaction: {
...exampleData.tip,
error: transactionError,
},
});
-export const TipPending = createExample(TestedComponent, {
+export const TipPending = tests.createExample(TestedComponent, {
transaction: { ...exampleData.tip, pending: true },
});
-export const Refund = createExample(TestedComponent, {
+export const Refund = tests.createExample(TestedComponent, {
transaction: exampleData.refund,
});
-export const RefundError = createExample(TestedComponent, {
+export const RefundError = tests.createExample(TestedComponent, {
transaction: {
...exampleData.refund,
error: transactionError,
},
});
-export const RefundPending = createExample(TestedComponent, {
+export const RefundPending = tests.createExample(TestedComponent, {
transaction: { ...exampleData.refund, pending: true },
});
-export const InvoiceCreditComplete = createExample(TestedComponent, {
+export const InvoiceCreditComplete = tests.createExample(TestedComponent, {
transaction: { ...exampleData.pull_credit },
});
-export const InvoiceCreditIncomplete = createExample(TestedComponent, {
+export const InvoiceCreditIncomplete = tests.createExample(TestedComponent, {
transaction: {
...exampleData.pull_credit,
pending: true,
},
});
-export const InvoiceDebit = createExample(TestedComponent, {
+export const InvoiceDebit = tests.createExample(TestedComponent, {
transaction: { ...exampleData.pull_debit },
});
-export const TransferCredit = createExample(TestedComponent, {
+export const TransferCredit = tests.createExample(TestedComponent, {
transaction: { ...exampleData.push_credit },
});
-export const TransferDebitComplete = createExample(TestedComponent, {
+export const TransferDebitComplete = tests.createExample(TestedComponent, {
transaction: { ...exampleData.push_debit },
});
-export const TransferDebitIncomplete = createExample(TestedComponent, {
+export const TransferDebitIncomplete = tests.createExample(TestedComponent, {
transaction: {
...exampleData.push_debit,
pending: true,