aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backend-ui
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-01-23 10:07:08 -0300
committerSebastian <sebasjm@gmail.com>2023-01-23 10:09:57 -0300
commitfdbe5c12e99804ea52757fdb0876ad95c2f75701 (patch)
tree33848f489300e50ce7bc04af9ec10201cf4edd5f /packages/merchant-backend-ui
parent0029013f8d9e4ca8b281fdaa38f5c8ae389f7def (diff)
downloadwallet-core-fdbe5c12e99804ea52757fdb0876ad95c2f75701.tar.gz
wallet-core-fdbe5c12e99804ea52757fdb0876ad95c2f75701.tar.bz2
wallet-core-fdbe5c12e99804ea52757fdb0876ad95c2f75701.zip
tune up backend dependecies
Diffstat (limited to 'packages/merchant-backend-ui')
-rw-r--r--packages/merchant-backend-ui/.storybook/.babelrc25
-rw-r--r--packages/merchant-backend-ui/.storybook/main.js82
-rw-r--r--packages/merchant-backend-ui/.storybook/preview.js73
-rw-r--r--packages/merchant-backend-ui/package.json73
-rw-r--r--packages/merchant-backend-ui/rollup.config.js2
-rw-r--r--packages/merchant-backend-ui/src/components/Footer.tsx27
-rw-r--r--packages/merchant-backend-ui/src/components/QR.tsx49
-rw-r--r--packages/merchant-backend-ui/src/hooks/backend.ts8
-rw-r--r--packages/merchant-backend-ui/src/pages/DepletedTip.tsx40
-rw-r--r--packages/merchant-backend-ui/tests/__mocks__/browserMocks.ts42
-rw-r--r--packages/merchant-backend-ui/tests/__mocks__/fileMocks.ts24
-rw-r--r--packages/merchant-backend-ui/tests/__mocks__/fileTransformer.js31
-rw-r--r--packages/merchant-backend-ui/tests/__mocks__/setupTests.ts28
-rw-r--r--packages/merchant-backend-ui/tests/funcitons/regex.test.ts87
-rw-r--r--packages/merchant-backend-ui/tests/util.ts62
-rw-r--r--packages/merchant-backend-ui/tsconfig.back.json23
16 files changed, 81 insertions, 595 deletions
diff --git a/packages/merchant-backend-ui/.storybook/.babelrc b/packages/merchant-backend-ui/.storybook/.babelrc
deleted file mode 100644
index 610b6f339..000000000
--- a/packages/merchant-backend-ui/.storybook/.babelrc
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2021 Taler Systems S.A.
-
- GNU 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.
-
- GNU 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
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
- /**
- *
- * @author Sebastian Javier Marchano (sebasjm)
- */
-{
- "presets": [
- "preact-cli/babel"
- ]
-} \ No newline at end of file
diff --git a/packages/merchant-backend-ui/.storybook/main.js b/packages/merchant-backend-ui/.storybook/main.js
deleted file mode 100644
index 5497a6510..000000000
--- a/packages/merchant-backend-ui/.storybook/main.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2021 Taler Systems S.A.
-
- GNU 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.
-
- GNU 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
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
-*
-* @author Sebastian Javier Marchano (sebasjm)
-*/
-
-
-module.exports = {
- "stories": [
- "../src/**/*.stories.mdx",
- "../src/**/*.stories.@(js|jsx|ts|tsx)"
- ],
- "addons": [
- "@storybook/preset-scss",
- "@storybook/addon-a11y",
- "@storybook/addon-essentials" //docs, control, actions, viewpot, toolbar, background
- ],
- // sb does not yet support new jsx transform by default
- // https://github.com/storybookjs/storybook/issues/12881
- // https://github.com/storybookjs/storybook/issues/12952
- babel: async (options) => ({
- ...options,
- presets: [
- ...options.presets,
- [
- '@babel/preset-react', {
- runtime: 'automatic',
- },
- 'preset-react-jsx-transform'
- ],
- "@linaria",
- ],
- }),
- webpackFinal: (config) => {
- // should be removed after storybook 6.3
- // https://github.com/storybookjs/storybook/issues/12853#issuecomment-821576113
- config.resolve.alias = {
- react: "preact/compat",
- "react-dom": "preact/compat",
- };
-
- // we need to add @linaria loader AFTER the babel-loader
- // https://github.com/callstack/linaria/blob/master/docs/BUNDLERS_INTEGRATION.md#webpack
- config.module.rules[0] = {
- ...(config.module.rules[0]),
- loader: undefined, // Disable the predefined babel-loader on the rule
- use: [
- {
- ...(config.module.rules[0].use[0]),
- loader: 'babel-loader',
- },
- {
- loader: '@linaria/webpack-loader',
- options: {
- sourceMap: true, //always true since this is dev
- babelOptions: {
- presets: config.module.rules[0].use[0].options.presets,
- }
- // Pass the current babel options to linaria's babel instance
- }
- }
- ]
- };
-
- return config;
- },
-} \ No newline at end of file
diff --git a/packages/merchant-backend-ui/.storybook/preview.js b/packages/merchant-backend-ui/.storybook/preview.js
deleted file mode 100644
index a9cc4c39a..000000000
--- a/packages/merchant-backend-ui/.storybook/preview.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2021 Taler Systems S.A.
-
- GNU 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.
-
- GNU 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
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-import { ConfigContextProvider } from '../src/context/config'
-import { InstanceContextProvider } from '../src/context/instance'
-import { TranslationProvider } from '../src/context/translation'
-import { BackendContextProvider } from '../src/context/backend'
-import { h } from 'preact';
-
-const mockConfig = {
- backendURL: 'http://demo.taler.net',
- currency: 'TESTKUDOS'
-}
-
-const mockInstance = {
- id: 'instance-id',
- token: 'instance-token',
- admin: false,
-}
-
-const mockBackend = {
- url: 'http://merchant.url',
- token: 'default-token',
- triedToLog: false,
-}
-
-export const parameters = {
- controls: { expanded: true },
- // actions: { argTypesRegex: "^on.*" },
-}
-
-export const globalTypes = {
- locale: {
- name: 'Locale',
- description: 'Internationalization locale',
- defaultValue: 'en',
- toolbar: {
- icon: 'globe',
- items: [
- { value: 'en', right: 'πŸ‡ΊπŸ‡Έ', title: 'English' },
- { value: 'es', right: 'πŸ‡ͺπŸ‡Έ', title: 'Spanish' },
- ],
- },
- },
-};
-
-export const decorators = [
- (Story, { globals }) => <TranslationProvider initial='en' forceLang={globals.locale}>
- <Story />
- </TranslationProvider>,
- (Story) => <ConfigContextProvider value={mockConfig}>
- <Story />
- </ConfigContextProvider>,
- (Story) => <InstanceContextProvider value={mockInstance}>
- <Story />
- </InstanceContextProvider>,
- (Story) => <BackendContextProvider defaultUrl={mockBackend.url}>
- <Story />
- </BackendContextProvider>,
-];
diff --git a/packages/merchant-backend-ui/package.json b/packages/merchant-backend-ui/package.json
index c6ef3a413..b4a886f7b 100644
--- a/packages/merchant-backend-ui/package.json
+++ b/packages/merchant-backend-ui/package.json
@@ -1,21 +1,18 @@
{
"private": true,
- "name": "merchant-backend",
- "version": "0.0.4",
- "license": "MIT",
+ "name": "@gnu-taler/merchant-backend",
+ "version": "0.0.5",
+ "license": "AGPL-3.0-or-later",
"scripts": {
+ "compile": "rollup -c",
"build": "rollup -c",
"dev": "rollup -c -w",
"render-examples": "ts-node -O '{\"module\": \"commonjs\"}' -T render-examples.ts dist/pages dist/examples",
"lint-check": "eslint '{src,tests}/**/*.{js,jsx,ts,tsx}'",
"lint-fix": "eslint --fix '{src,tests}/**/*.{js,jsx,ts,tsx}'",
- "test": "jest ./tests",
- "dev-test": "jest ./tests --watch",
"typedoc": "typedoc src",
- "clean": "rimraf build storybook-static docs single dist",
- "serve-dist": "sirv --port ${PORT:=8080} --cors --single dist",
- "build-storybook": "build-storybook",
- "storybook": "start-storybook -p 6006"
+ "clean": "rimraf build docs single dist",
+ "serve-dist": "sirv --port ${PORT:=8080} --cors --single dist"
},
"engines": {
"node": ">=12",
@@ -46,15 +43,14 @@
"date-fns": "^2.21.1",
"history": "4.10.1",
"jed": "^1.1.1",
- "preact": "^10.5.13",
- "preact-router": "^3.2.1",
+ "preact": "10.11.3",
+ "preact-router": "3.2.1",
"qrcode-generator": "^1.4.4",
"swr": "^0.5.5",
"yup": "^0.32.9"
},
"devDependencies": {
"@babel/core": "7.18.9",
- "@babel/plugin-transform-react-jsx-source": "7.18.6",
"@creativebulma/bulma-tooltip": "^1.2.0",
"@gnu-taler/pogen": "^0.0.5",
"@linaria/babel-preset": "3.0.0-beta.22",
@@ -70,75 +66,26 @@
"@rollup/plugin-image": "^2.1.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-replace": "^3.0.0",
- "@rollup/plugin-typescript": "^8.2.5",
- "@storybook/addon-a11y": "^6.2.9",
- "@storybook/addon-actions": "^6.2.9",
- "@storybook/addon-essentials": "^6.2.9",
- "@storybook/addon-links": "^6.2.9",
- "@storybook/preact": "^6.2.9",
- "@storybook/preset-scss": "^1.0.3",
- "@testing-library/preact": "^2.0.1",
- "@testing-library/preact-hooks": "^1.1.0",
- "@types/enzyme": "^3.10.8",
+ "@rollup/plugin-typescript": "11",
"@types/history": "^4.7.8",
- "@types/jest": "^26.0.23",
"@types/mocha": "^8.2.2",
"@types/mustache": "^4.1.2",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"babel-loader": "^8.2.2",
"base64-inline-loader": "^1.1.1",
- "bulma": "^0.9.2",
- "bulma-checkbox": "^1.1.1",
- "bulma-radio": "^1.1.1",
- "bulma-responsive-tables": "^1.2.3",
- "bulma-switch-control": "^1.1.1",
- "bulma-timeline": "^3.0.4",
- "bulma-upload-control": "^1.2.0",
- "dotenv": "^8.2.0",
- "enzyme": "^3.11.0",
- "enzyme-adapter-preact-pure": "^3.1.0",
"eslint": "^7.25.0",
"eslint-config-preact": "^1.1.4",
"eslint-plugin-header": "^3.1.1",
- "html-webpack-inline-chunk-plugin": "^1.1.1",
- "html-webpack-inline-source-plugin": "0.0.10",
- "html-webpack-skip-assets-plugin": "^1.0.1",
- "inline-chunk-html-plugin": "^1.1.1",
- "jest": "^26.6.3",
- "jest-preset-preact": "^4.0.2",
"mustache": "^4.2.0",
"po2json": "^0.4.5",
- "preact-cli": "^3.0.5",
- "preact-render-to-json": "^3.6.6",
"preact-render-to-string": "^5.1.19",
"rimraf": "^3.0.2",
"rollup": "^2.56.3",
"rollup-plugin-bundle-html": "^0.2.2",
"rollup-plugin-css-only": "^3.1.0",
- "sass": "^1.32.13",
- "sass-loader": "10.1.1",
"script-ext-html-webpack-plugin": "^2.1.5",
"sirv-cli": "^1.0.11",
- "tslib": "^2.3.1",
- "typedoc": "^0.20.36",
- "typescript": "^4.2.4"
- },
- "jest": {
- "preset": "jest-preset-preact",
- "transformIgnorePatterns": [
- "node_modules/.pnpm/(?!(@gnu-taler\\+taler-util))",
- "\\.pnp\\.[^\\/]+$"
- ],
- "setupFiles": [
- "<rootDir>/tests/__mocks__/browserMocks.ts",
- "<rootDir>/tests/__mocks__/setupTests.ts"
- ],
- "moduleNameMapper": {
- "\\.(css|less)$": "identity-obj-proxy"
- },
- "transform": {
- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|po)$": "<rootDir>/tests/__mocks__/fileTransformer.js"
- }
+ "typescript": "4.8.4"
}
}
diff --git a/packages/merchant-backend-ui/rollup.config.js b/packages/merchant-backend-ui/rollup.config.js
index f5227ba74..7707c13a0 100644
--- a/packages/merchant-backend-ui/rollup.config.js
+++ b/packages/merchant-backend-ui/rollup.config.js
@@ -26,8 +26,6 @@ import css from 'rollup-plugin-css-only';
import html from '@rollup/plugin-html';
import commonjs from "@rollup/plugin-commonjs";
-
-
const template = async ({
files,
}) => {
diff --git a/packages/merchant-backend-ui/src/components/Footer.tsx b/packages/merchant-backend-ui/src/components/Footer.tsx
index 5f2957800..278e4a543 100644
--- a/packages/merchant-backend-ui/src/components/Footer.tsx
+++ b/packages/merchant-backend-ui/src/components/Footer.tsx
@@ -15,18 +15,21 @@
*/
/**
-*
-* @author Sebastian Javier Marchano (sebasjm)
-*/
-import { h, VNode } from 'preact';
-import { FooterBar } from '../styled';
+ *
+ * @author Sebastian Javier Marchano (sebasjm)
+ */
+import { h, VNode } from "preact";
+import { FooterBar } from "../styled/index.js";
export function Footer(): VNode {
- return <FooterBar>
- <p>
- <a href="https://taler.net/">Learn more about GNU Taler on our website.</a>
- <p>Copyright &copy; 2014&mdash;2021 Taler Systems SA</p>
- </p>
- </FooterBar>
+ return (
+ <FooterBar>
+ <p>
+ <a href="https://taler.net/">
+ Learn more about GNU Taler on our website.
+ </a>
+ <p>Copyright &copy; 2014&mdash;2021 Taler Systems SA</p>
+ </p>
+ </FooterBar>
+ );
}
-
diff --git a/packages/merchant-backend-ui/src/components/QR.tsx b/packages/merchant-backend-ui/src/components/QR.tsx
index 29c9920bf..425a94961 100644
--- a/packages/merchant-backend-ui/src/components/QR.tsx
+++ b/packages/merchant-backend-ui/src/components/QR.tsx
@@ -14,28 +14,41 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
- import { h, VNode } from "preact";
- import { useEffect, useRef } from "preact/hooks";
- import qrcode from "qrcode-generator";
-
-export function createSVG(text:string):string {
- const qr = qrcode(0, 'L');
+import { h, VNode } from "preact";
+import { useEffect, useRef } from "preact/hooks";
+import qrcode from "qrcode-generator";
+
+export function createSVG(text: string): string {
+ const qr = qrcode(0, "L");
qr.addData(text);
qr.make();
return qr.createSvgTag({
scalable: true,
- margin: 0
+ margin: 0,
});
}
- export function QR({ text }: { text: string; }):VNode {
- const divRef = useRef<HTMLDivElement>(null);
- useEffect(() => {
- divRef.current.innerHTML = createSVG(text)
- });
-
- return <div style={{ width: '100%', display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
- <div style={{ width: '50%', minWidth: 200, maxWidth: 300 }} ref={divRef} />
- </div>;
- }
- \ No newline at end of file
+export function QR({ text }: { text: string }): VNode {
+ const divRef = useRef<HTMLDivElement>(null);
+ useEffect(() => {
+ if (divRef.current) {
+ divRef.current.innerHTML = createSVG(text);
+ }
+ });
+
+ return (
+ <div
+ style={{
+ width: "100%",
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center",
+ }}
+ >
+ <div
+ style={{ width: "50%", minWidth: 200, maxWidth: 300 }}
+ ref={divRef}
+ />
+ </div>
+ );
+}
diff --git a/packages/merchant-backend-ui/src/hooks/backend.ts b/packages/merchant-backend-ui/src/hooks/backend.ts
index 96b8f7139..044344d5d 100644
--- a/packages/merchant-backend-ui/src/hooks/backend.ts
+++ b/packages/merchant-backend-ui/src/hooks/backend.ts
@@ -209,7 +209,7 @@ export async function request<T>(url: string, options: RequestOptions = {}): Pro
url,
responseType: 'json',
headers,
- cancelToken: !removeAxiosCancelToken? source.token : undefined,
+ cancelToken: !removeAxiosCancelToken ? source.token : undefined,
method: options.method || 'get',
data: options.data,
params: options.params,
@@ -217,8 +217,10 @@ export async function request<T>(url: string, options: RequestOptions = {}): Pro
})
return buildRequestOk<T>(res, url, !!options.token)
} catch (e) {
- const error = buildRequestFailed(e, url, !!options.token)
- throw error
+ if (axios.isAxiosError(e)) {
+ throw buildRequestFailed(e, url, !!options.token)
+ }
+ throw e
}
}
diff --git a/packages/merchant-backend-ui/src/pages/DepletedTip.tsx b/packages/merchant-backend-ui/src/pages/DepletedTip.tsx
index 756b08d6a..61fc52cdf 100644
--- a/packages/merchant-backend-ui/src/pages/DepletedTip.tsx
+++ b/packages/merchant-backend-ui/src/pages/DepletedTip.tsx
@@ -15,30 +15,30 @@
*/
/**
-*
-* @author Sebastian Javier Marchano (sebasjm)
-*/
-import { Fragment, h, render, VNode } from 'preact';
-import { render as renderToString } from 'preact-render-to-string';
-import { Footer } from '../components/Footer';
+ *
+ * @author Sebastian Javier Marchano (sebasjm)
+ */
+import { Fragment, h, render, VNode } from "preact";
+import { render as renderToString } from "preact-render-to-string";
+import { Footer } from "../components/Footer";
import "../css/pure-min.css";
import "../css/style.css";
-import { Page } from '../styled';
+import { Page } from "../styled";
function Head(): VNode {
- return <title>Status of your tip</title>
+ return <title>Status of your tip</title>;
}
export function DepletedTip(): VNode {
- return <Page>
- <section>
- <h1>Tip already collected</h1>
- <div>
- You have already collected this tip.
- </div>
- </section>
- <Footer />
- </Page>
+ return (
+ <Page>
+ <section>
+ <h1>Tip already collected</h1>
+ <div>You have already collected this tip.</div>
+ </section>
+ <Footer />
+ </Page>
+ );
}
export function mount(): void {
@@ -52,9 +52,9 @@ export function mount(): void {
}
}
-export function buildTimeRendering(): { head: string, body: string } {
+export function buildTimeRendering(): { head: string; body: string } {
return {
head: renderToString(<Head />),
- body: renderToString(<DepletedTip />)
- }
+ body: renderToString(<DepletedTip />),
+ };
}
diff --git a/packages/merchant-backend-ui/tests/__mocks__/browserMocks.ts b/packages/merchant-backend-ui/tests/__mocks__/browserMocks.ts
deleted file mode 100644
index ee6bba505..000000000
--- a/packages/merchant-backend-ui/tests/__mocks__/browserMocks.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2021 Taler Systems S.A.
-
- GNU 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.
-
- GNU 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
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
- /**
- *
- * @author Sebastian Javier Marchano (sebasjm)
- */
-
-// Mock Browser API's which are not supported by JSDOM, e.g. ServiceWorker, LocalStorage
-/**
- * An example how to mock localStorage is given below πŸ‘‡
- */
-
-/*
-// Mocks localStorage
-const localStorageMock = (function() {
- let store = {};
-
- return {
- getItem: (key) => store[key] || null,
- setItem: (key, value) => store[key] = value.toString(),
- clear: () => store = {}
- };
-
-})();
-
-Object.defineProperty(window, 'localStorage', {
- value: localStorageMock
-}); */
diff --git a/packages/merchant-backend-ui/tests/__mocks__/fileMocks.ts b/packages/merchant-backend-ui/tests/__mocks__/fileMocks.ts
deleted file mode 100644
index 0c045e9d1..000000000
--- a/packages/merchant-backend-ui/tests/__mocks__/fileMocks.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2021 Taler Systems S.A.
-
- GNU 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.
-
- GNU 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
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
- /**
- *
- * @author Sebastian Javier Marchano (sebasjm)
- */
-
-// This fixed an error related to the CSS and loading gif breaking my Jest test
-// See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets
-export default 'test-file-stub';
diff --git a/packages/merchant-backend-ui/tests/__mocks__/fileTransformer.js b/packages/merchant-backend-ui/tests/__mocks__/fileTransformer.js
deleted file mode 100644
index 51ebbfa62..000000000
--- a/packages/merchant-backend-ui/tests/__mocks__/fileTransformer.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2021 Taler Systems S.A.
-
- GNU 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.
-
- GNU 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
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
-*
-* @author Sebastian Javier Marchano (sebasjm)
-*/
-// fileTransformer.js
-
-// eslint-disable-next-line @typescript-eslint/no-var-requires
-const path = require('path');
-
-module.exports = {
- process(src, filename, config, options) {
- return `module.exports = ${ JSON.stringify(path.basename(filename)) };`;
- },
-};
-
diff --git a/packages/merchant-backend-ui/tests/__mocks__/setupTests.ts b/packages/merchant-backend-ui/tests/__mocks__/setupTests.ts
deleted file mode 100644
index ab0f08b2f..000000000
--- a/packages/merchant-backend-ui/tests/__mocks__/setupTests.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2021 Taler Systems S.A.
-
- GNU 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.
-
- GNU 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
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
- /**
- *
- * @author Sebastian Javier Marchano (sebasjm)
- */
-
-import 'regenerator-runtime/runtime'
-import { configure } from 'enzyme';
-import Adapter from 'enzyme-adapter-preact-pure';
-
-configure({
- adapter: new Adapter()
-});
diff --git a/packages/merchant-backend-ui/tests/funcitons/regex.test.ts b/packages/merchant-backend-ui/tests/funcitons/regex.test.ts
deleted file mode 100644
index fc8a6a42f..000000000
--- a/packages/merchant-backend-ui/tests/funcitons/regex.test.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2021 Taler Systems S.A.
-
- GNU 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.
-
- GNU 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
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
- /**
- *
- * @author Sebastian Javier Marchano (sebasjm)
- */
-
-import { AMOUNT_REGEX, PAYTO_REGEX } from "../../src/utils/constants";
-
-describe('payto uri format', () => {
- const valids = [
- 'payto://iban/DE75512108001245126199?amount=EUR:200.0&message=hello',
- 'payto://ach/122000661/1234',
- 'payto://upi/alice@example.com?receiver-name=Alice&amount=INR:200',
- 'payto://void/?amount=EUR:10.5',
- 'payto://ilp/g.acme.bob'
- ]
-
- test('should be valid', () => {
- valids.forEach(v => expect(v).toMatch(PAYTO_REGEX))
- });
-
- const invalids = [
- // has two question marks
- 'payto://iban/DE75?512108001245126199?amount=EUR:200.0&message=hello',
- // has a space
- 'payto://ach /122000661/1234',
- // has a space
- 'payto://upi/alice@ example.com?receiver-name=Alice&amount=INR:200',
- // invalid field name (mount instead of amount)
- 'payto://void/?mount=EUR:10.5',
- // payto:// is incomplete
- 'payto: //ilp/g.acme.bob'
- ]
-
- test('should not be valid', () => {
- invalids.forEach(v => expect(v).not.toMatch(PAYTO_REGEX))
- });
-})
-
-describe('amount format', () => {
- const valids = [
- 'ARS:10',
- 'COL:10.2',
- 'UY:1,000.2',
- 'ARS:10.123,123',
- 'ARS:1,000,000',
- 'ARSCOL:10',
- 'THISISTHEMOTHERCOIN:1,000,000.123,123',
- ]
-
- test('should be valid', () => {
- valids.forEach(v => expect(v).toMatch(AMOUNT_REGEX))
- });
-
- const invalids = [
- //no currency name
- ':10',
- //use . instead of ,
- 'ARS:1.000.000',
- //currency name with numbers
- '1ARS:10',
- //currency name with numbers
- 'AR5:10',
- //missing value
- 'USD:',
- ]
-
- test('should not be valid', () => {
- invalids.forEach(v => expect(v).not.toMatch(AMOUNT_REGEX))
- });
-
-}) \ No newline at end of file
diff --git a/packages/merchant-backend-ui/tests/util.ts b/packages/merchant-backend-ui/tests/util.ts
deleted file mode 100644
index 14b82b51c..000000000
--- a/packages/merchant-backend-ui/tests/util.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2021 Taler Systems S.A.
-
- GNU 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.
-
- GNU 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
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
-*
-* @author Sebastian Javier Marchano (sebasjm)
-*/
-import * as axios from 'axios';
-
-type Query<Req, Res> = (GetQuery | PostQuery | DeleteQuery | PatchQuery) & RequestResponse<Req, Res>
-
-interface RequestResponse<Req, Res> {
- request?: Req,
- params?: any,
- response?: Res,
-}
-interface GetQuery { get: string }
-interface PostQuery { post: string }
-interface DeleteQuery { delete: string }
-interface PatchQuery { patch: string }
-
-export function simulateBackendResponse<R, T>(query: Query<R, T>): void {
- (axios.default as jest.MockedFunction<axios.AxiosStatic>).mockImplementationOnce(function (opt?: axios.AxiosRequestConfig): axios.AxiosPromise {
- // console.log(opt, JSON.stringify(query,undefined,2))
- expect(opt).toBeDefined();
- if (!opt)
- return Promise.reject();
-
- // expect(query.request).toStrictEqual(opt.data);
- // expect(query.params).toStrictEqual(opt.params);
- if ('get' in query) {
- expect(opt.method).toBe('get');
- expect(opt.url).toBe(query.get);
- }
- if ('post' in query) {
- expect(opt.method).toBe('post');
- expect(opt.url).toBe(query.post);
- }
- if ('delete' in query) {
- expect(opt.method).toBe('delete');
- expect(opt.url).toBe(query.delete);
- }
- if ('patch' in query) {
- expect(opt.method).toBe('patch');
- expect(opt.url).toBe(query.patch);
- }
- return ({ data: query.response, config: {} } as any);
- } as any)
-}
diff --git a/packages/merchant-backend-ui/tsconfig.back.json b/packages/merchant-backend-ui/tsconfig.back.json
deleted file mode 100644
index 9ac5a3c25..000000000
--- a/packages/merchant-backend-ui/tsconfig.back.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "compilerOptions": {
- "composite": true,
- "lib": ["es6", "DOM"],
- "jsx": "react",
- "jsxFactory": "h",
- "jsxFragmentFactory": "Fragment",
- "moduleResolution": "Node",
- "module": "ESNext",
- "target": "ES6",
- "noImplicitAny": true,
- "noEmitOnError": true,
- "strict": true,
- "incremental": true,
- "sourceMap": true,
- "esModuleInterop": true,
- "importHelpers": true,
- "rootDir": "./src",
- "typeRoots": ["./node_modules/@types"]
- },
- "include": ["src/**/*"]
- }
- \ No newline at end of file