From 4a781bd0dd8828ce152f6ab2c3f1bbd6b5e826f7 Mon Sep 17 00:00:00 2001 From: Sebastian 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 --- .../taler-wallet-webextension/src/stories.test.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'packages/taler-wallet-webextension/src/stories.test.ts') diff --git a/packages/taler-wallet-webextension/src/stories.test.ts b/packages/taler-wallet-webextension/src/stories.test.ts index 47061282d..f02aa5cba 100644 --- a/packages/taler-wallet-webextension/src/stories.test.ts +++ b/packages/taler-wallet-webextension/src/stories.test.ts @@ -20,15 +20,17 @@ */ import { setupI18n } from "@gnu-taler/taler-util"; import { parseGroupImport } from "@gnu-taler/web-util/lib/index.browser"; -import { setupPlatform } from "./platform/foreground.js"; import chromeAPI from "./platform/chrome.js"; -import { renderNodeOrBrowser } from "./test-utils.js"; +import { setupPlatform } from "./platform/foreground.js"; import * as components from "./components/index.stories.js"; import * as cta from "./cta/index.stories.js"; import * as mui from "./mui/index.stories.js"; import * as popup from "./popup/index.stories.js"; import * as wallet from "./wallet/index.stories.js"; +import { renderNodeOrBrowser } from "./test-utils.js"; +import { h, VNode } from "preact"; +import { AlertProvider } from "./context/alert.js"; setupI18n("en", { en: {} }); setupPlatform(chromeAPI); @@ -41,10 +43,15 @@ describe("All the examples:", () => { describe(`Component ${component.name}:`, () => { component.examples.forEach((example) => { it(`should render example: ${example.name}`, () => { - renderNodeOrBrowser( - example.render.component, - example.render.props, - ); + function C(): VNode { + const B = h(example.render.component, example.render.props); + //FIXME: + //some components push the alter in the UI function + //that's not correct, should be moved into the sate function + // until then, we ran the tests with the alert provider + return h(AlertProvider, { children: B }, B); + } + renderNodeOrBrowser(C, {}); }); }); }); -- cgit v1.2.3