aboutsummaryrefslogtreecommitdiff
path: root/packages/frontend
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2021-06-25 12:26:05 -0300
committerSebastian <sebasjm@gmail.com>2021-06-25 12:26:10 -0300
commit2342eec8dc94a3d8a70aae240bed3112f6c56534 (patch)
treeef0e895e6369c93c0fe8b6d6f00c3c43e6836bf9 /packages/frontend
parent1ce7ccc04487406250cee603638950b80d6a779a (diff)
downloadmerchant-backoffice-2342eec8dc94a3d8a70aae240bed3112f6c56534.tar.gz
merchant-backoffice-2342eec8dc94a3d8a70aae240bed3112f6c56534.tar.bz2
merchant-backoffice-2342eec8dc94a3d8a70aae240bed3112f6c56534.zip
fix test checking the wrong thing
Diffstat (limited to 'packages/frontend')
-rw-r--r--packages/frontend/src/components/form/InputArray.tsx2
-rw-r--r--packages/frontend/tests/stories.test.tsx15
2 files changed, 10 insertions, 7 deletions
diff --git a/packages/frontend/src/components/form/InputArray.tsx b/packages/frontend/src/components/form/InputArray.tsx
index 9f16cbf..984c6dc 100644
--- a/packages/frontend/src/components/form/InputArray.tsx
+++ b/packages/frontend/src/components/form/InputArray.tsx
@@ -39,8 +39,6 @@ export function InputArray<T>({ name, readonly, placeholder, tooltip, label, hel
const error = localError || formError
- console.log(formError, localError)
-
const array: any[] = (value ? value! : []) as any;
const [currentValue, setCurrentValue] = useState('');
const i18n = useTranslator();
diff --git a/packages/frontend/tests/stories.test.tsx b/packages/frontend/tests/stories.test.tsx
index 996aebb..c8a7f80 100644
--- a/packages/frontend/tests/stories.test.tsx
+++ b/packages/frontend/tests/stories.test.tsx
@@ -20,7 +20,8 @@
*/
import { mount } from 'enzyme';
import { h } from 'preact';
-import * as ctx from '../src/context/config';
+import * as config from '../src/context/config';
+import * as i18n from '../src/context/translation';
import fs from 'fs';
@@ -39,11 +40,15 @@ function getFiles(dir: string, files_: string[] = []) {
const re = RegExp('.*\.stories.tsx')
+import * as jedLib from "jed";
+const handler = new jedLib.Jed('en');
+
it('render every story', () => {
- jest.spyOn(ctx, 'useConfigContext').mockImplementation(() => ({ version: '1.0.0', currency: 'EUR' }));
+ jest.spyOn(config, 'useConfigContext').mockImplementation(() => ({ version: '1.0.0', currency: 'EUR' }));
+ jest.spyOn(i18n, 'useTranslationContext').mockImplementation(() => ({ changeLanguage: () => null, handler, lang: 'en' }));
getFiles('./src').filter(f => re.test(f)).map(f => {
-
+ // const f = "./src/paths/instance/transfers/list/List.stories.tsx";
// eslint-disable-next-line @typescript-eslint/no-var-requires
const s = require(`../${f}`)
@@ -51,8 +56,8 @@ it('render every story', () => {
Object.keys(s).forEach(k => {
const Component = s[k];
expect(() => {
- mount(<Component {...Component.args} />);
- }).not.toThrow(`problem rendering ${f} example ${k}`)
+ mount(<Component {...Component.args} />).mount().unmount().mount();
+ }).not.toThrow() //`problem rendering ${f} example ${k}`
})
})