From 9d997280d36b3bd41532017a167410db4dcec696 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 15 Apr 2022 18:04:42 -0300 Subject: missing tests --- .../src/components/ExchangeToS.tsx | 4 +++ .../src/cta/TermsOfServiceSection.stories.tsx | 14 +++++++-- .../src/cta/return-coins.tsx | 35 ---------------------- .../taler-wallet-webextension/src/stories.test.ts | 4 ++- 4 files changed, 18 insertions(+), 39 deletions(-) delete mode 100644 packages/taler-wallet-webextension/src/cta/return-coins.tsx (limited to 'packages/taler-wallet-webextension') diff --git a/packages/taler-wallet-webextension/src/components/ExchangeToS.tsx b/packages/taler-wallet-webextension/src/components/ExchangeToS.tsx index 6aee838a1..d54d66dc5 100644 --- a/packages/taler-wallet-webextension/src/components/ExchangeToS.tsx +++ b/packages/taler-wallet-webextension/src/components/ExchangeToS.tsx @@ -17,6 +17,10 @@ import { Fragment, VNode, h } from "preact"; import { useState } from "preact/hooks"; export function ExchangeXmlTos({ doc }: { doc: Document }): VNode { + if (typeof window === "undefined") { + // in nodejs env we don't have xml api + return
; + } const termsNode = doc.querySelector("[ids=terms-of-service]"); if (!termsNode) { return ( diff --git a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx index f24da1e13..4a0296baa 100644 --- a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx +++ b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx @@ -60,11 +60,19 @@ export const ReviewingHTML = createExample(TestedComponent, { }); function toBase64(str: string): string { - return btoa( - encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) { + const encoded = encodeURIComponent(str).replace( + /%([0-9A-F]{2})/g, + function (match, p1) { return String.fromCharCode(parseInt(p1, 16)); - }), + }, ); + if (typeof btoa === "undefined") { + //nodejs + return Buffer.from(encoded).toString("base64"); + } else { + //browser + return btoa(encoded); + } } export const ReviewingPDF = createExample(TestedComponent, { diff --git a/packages/taler-wallet-webextension/src/cta/return-coins.tsx b/packages/taler-wallet-webextension/src/cta/return-coins.tsx deleted file mode 100644 index ae2bb07b6..000000000 --- a/packages/taler-wallet-webextension/src/cta/return-coins.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - This file is part of TALER - (C) 2017 Inria - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see - */ - -import { h, VNode } from "preact"; -import { useTranslationContext } from "../context/translation.js"; -/** - * Return coins to own bank account. - * - * @author sebasjm - */ - -/** - * Imports. - */ -export function CreateReturnCoinsPage(): VNode { - const { i18n } = useTranslationContext(); - return ( - - Not implemented yet. - - ); -} diff --git a/packages/taler-wallet-webextension/src/stories.test.ts b/packages/taler-wallet-webextension/src/stories.test.ts index cd6f88135..7e6be4283 100644 --- a/packages/taler-wallet-webextension/src/stories.test.ts +++ b/packages/taler-wallet-webextension/src/stories.test.ts @@ -21,6 +21,8 @@ import * as popup from "./popup/index.stories.js"; import * as wallet from "./wallet/index.stories.js"; import * as mui from "./mui/index.stories.js"; +import * as cta from "./cta/index.stories.js"; +import * as components from "./components/index.stories.js"; import { setupI18n } from "@gnu-taler/taler-util"; import { renderNodeOrBrowser } from "./test-utils.js"; @@ -40,7 +42,7 @@ function testThisStory(st: any): any { } describe("render every storybook example", () => { - [popup, wallet, mui].forEach(function testAll(st: any) { + [popup, wallet, cta, mui, components].forEach(function testAll(st: any) { if (Array.isArray(st.default)) { st.default.forEach(testAll) } else { -- cgit v1.2.3