merchant-backoffice

ZZZ: Inactive/Deprecated
Log | Files | Refs | Submodules | README

commit 2342eec8dc94a3d8a70aae240bed3112f6c56534
parent 1ce7ccc04487406250cee603638950b80d6a779a
Author: Sebastian <sebasjm@gmail.com>
Date:   Fri, 25 Jun 2021 12:26:05 -0300

fix test checking the wrong thing

Diffstat:
Mpackages/frontend/src/components/form/InputArray.tsx | 2--
Mpackages/frontend/tests/stories.test.tsx | 15++++++++++-----
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 @@ -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 @@ -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}` }) })