From 4a781bd0dd8828ce152f6ab2c3f1bbd6b5e826f7 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Mon, 9 Jan 2023 20:20:09 -0300
Subject: 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
---
 .../src/wallet/Settings.stories.tsx                | 97 ++++++++++++----------
 1 file changed, 53 insertions(+), 44 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/wallet/Settings.stories.tsx')

diff --git a/packages/taler-wallet-webextension/src/wallet/Settings.stories.tsx b/packages/taler-wallet-webextension/src/wallet/Settings.stories.tsx
index 04b7f3e09..53bc577d4 100644
--- a/packages/taler-wallet-webextension/src/wallet/Settings.stories.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Settings.stories.tsx
@@ -19,7 +19,7 @@
  * @author Sebastian Javier Marchano (sebasjm)
  */
 
-import { createExample } from "../test-utils.js";
+import { tests } from "@gnu-taler/web-util/lib/index.browser";
 import { SettingsView as TestedComponent } from "./Settings.js";
 
 export default {
@@ -45,7 +45,7 @@ const version = {
   },
 };
 
-export const AllOff = createExample(TestedComponent, {
+export const AllOff = tests.createExample(TestedComponent, {
   deviceName: "this-is-the-device-name",
   devModeToggle: { value: false, button: {} },
   autoOpenToggle: { value: false, button: {} },
@@ -54,7 +54,7 @@ export const AllOff = createExample(TestedComponent, {
   ...version,
 });
 
-export const OneChecked = createExample(TestedComponent, {
+export const OneChecked = tests.createExample(TestedComponent, {
   deviceName: "this-is-the-device-name",
   devModeToggle: { value: false, button: {} },
   autoOpenToggle: { value: false, button: {} },
@@ -63,7 +63,7 @@ export const OneChecked = createExample(TestedComponent, {
   ...version,
 });
 
-export const WithOneExchange = createExample(TestedComponent, {
+export const WithOneExchange = tests.createExample(TestedComponent, {
   deviceName: "this-is-the-device-name",
   devModeToggle: { value: false, button: {} },
   autoOpenToggle: { value: false, button: {} },
@@ -85,45 +85,54 @@ export const WithOneExchange = createExample(TestedComponent, {
   ...version,
 });
 
-export const WithExchangeInDifferentState = createExample(TestedComponent, {
-  deviceName: "this-is-the-device-name",
-  devModeToggle: { value: false, button: {} },
-  autoOpenToggle: { value: false, button: {} },
-  clipboardToggle: { value: false, button: {} },
-  setDeviceName: () => Promise.resolve(),
-  knownExchanges: [
-    {
-      currency: "USD",
-      exchangeBaseUrl: "http://exchange1.taler",
-      tos: {
-        currentVersion: "1",
-        acceptedVersion: "1",
-        content: "content of tos",
-        contentType: "text/plain",
-      },
-      paytoUris: ["payto://x-taler-bank/bank.rpi.sebasjm.com/exchangeminator"],
-    },
-    {
-      currency: "USD",
-      exchangeBaseUrl: "http://exchange2.taler",
-      tos: {
-        currentVersion: "2",
-        acceptedVersion: "1",
-        content: "content of tos",
-        contentType: "text/plain",
+export const WithExchangeInDifferentState = tests.createExample(
+  TestedComponent,
+  {
+    deviceName: "this-is-the-device-name",
+    devModeToggle: { value: false, button: {} },
+    autoOpenToggle: { value: false, button: {} },
+    clipboardToggle: { value: false, button: {} },
+    setDeviceName: () => Promise.resolve(),
+    knownExchanges: [
+      {
+        currency: "USD",
+        exchangeBaseUrl: "http://exchange1.taler",
+        tos: {
+          currentVersion: "1",
+          acceptedVersion: "1",
+          content: "content of tos",
+          contentType: "text/plain",
+        },
+        paytoUris: [
+          "payto://x-taler-bank/bank.rpi.sebasjm.com/exchangeminator",
+        ],
       },
-      paytoUris: ["payto://x-taler-bank/bank.rpi.sebasjm.com/exchangeminator"],
-    } as any, //TODO: complete with auditors, wireInfo and denominations
-    {
-      currency: "USD",
-      exchangeBaseUrl: "http://exchange3.taler",
-      tos: {
-        currentVersion: "1",
-        content: "content of tos",
-        contentType: "text/plain",
+      {
+        currency: "USD",
+        exchangeBaseUrl: "http://exchange2.taler",
+        tos: {
+          currentVersion: "2",
+          acceptedVersion: "1",
+          content: "content of tos",
+          contentType: "text/plain",
+        },
+        paytoUris: [
+          "payto://x-taler-bank/bank.rpi.sebasjm.com/exchangeminator",
+        ],
+      } as any, //TODO: complete with auditors, wireInfo and denominations
+      {
+        currency: "USD",
+        exchangeBaseUrl: "http://exchange3.taler",
+        tos: {
+          currentVersion: "1",
+          content: "content of tos",
+          contentType: "text/plain",
+        },
+        paytoUris: [
+          "payto://x-taler-bank/bank.rpi.sebasjm.com/exchangeminator",
+        ],
       },
-      paytoUris: ["payto://x-taler-bank/bank.rpi.sebasjm.com/exchangeminator"],
-    },
-  ],
-  ...version,
-});
+    ],
+    ...version,
+  },
+);
-- 
cgit v1.2.3

