diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/stories.test.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/stories.test.ts | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/packages/taler-wallet-webextension/src/stories.test.ts b/packages/taler-wallet-webextension/src/stories.test.ts index 76e3db5f4..bf6ef2afe 100644 --- a/packages/taler-wallet-webextension/src/stories.test.ts +++ b/packages/taler-wallet-webextension/src/stories.test.ts @@ -19,7 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ import { setupI18n } from "@gnu-taler/taler-util"; -import { parseGroupImport } from "@gnu-taler/web-util/lib/index.browser"; +import { parseGroupImport, tests } from "@gnu-taler/web-util/lib/index.browser"; import chromeAPI from "./platform/chrome.js"; import { setupPlatform } from "./platform/foreground.js"; @@ -28,8 +28,8 @@ 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 { renderNodeOrBrowser } from "./test-utils.js"; +import { h, VNode, ComponentChildren } from "preact"; import { AlertProvider } from "./context/alert.js"; setupI18n("en", { en: {} }); @@ -43,15 +43,7 @@ describe("All the examples:", () => { describe(`Component ${component.name}:`, () => { component.examples.forEach((example) => { it(`should render example: ${example.name}`, () => { - 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 state function - // until then, we ran the tests with the alert provider - return h(AlertProvider, { children: B }, B); - } - renderNodeOrBrowser(C, {}); + tests.renderUI(example.render, DefaultTestingContext); }); }); }); @@ -59,3 +51,14 @@ describe("All the examples:", () => { }); }); }); +function DefaultTestingContext({ + children, +}: { + children: ComponentChildren; +}): VNode { + //FIXME: + //some components push the alter in the UI function + //that's not correct, should be moved into the state function + // until then, we ran the tests with the alert provider + return h(AlertProvider, { children }); +} |