diff options
author | Sebastian <sebasjm@gmail.com> | 2023-04-21 10:47:47 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-04-21 10:47:47 -0300 |
commit | f470f167e32d8f7775ad994f09afb1d353b0b300 (patch) | |
tree | 3a1f2a040bb09d6639c81436b90b416fb8044f91 /packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx | |
parent | 6dcc488a2c8fd681941e5d3b62bb04af7669888e (diff) | |
download | wallet-core-f470f167e32d8f7775ad994f09afb1d353b0b300.tar.xz |
integrate anastasis to the web-utils testing api
Diffstat (limited to 'packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx')
-rw-r--r-- | packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx index 38fc1b56b..bc62961a5 100644 --- a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx @@ -20,7 +20,8 @@ */ import { ReducerState } from "@gnu-taler/anastasis-core"; -import { createExample, reducerStatesExample } from "../../utils/index.js"; +import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import { reducerStatesExample } from "../../utils/index.js"; import { AttributeEntryScreen as TestedComponent } from "./AttributeEntryScreen.js"; export default { @@ -35,7 +36,7 @@ export default { }, }; -export const Backup = createExample(TestedComponent, { +export const Backup = tests.createExample(TestedComponent, {}, { ...reducerStatesExample.backupAttributeEditing, required_attributes: [ { @@ -62,7 +63,7 @@ export const Backup = createExample(TestedComponent, { ], } as ReducerState); -export const Recovery = createExample(TestedComponent, { +export const Recovery = tests.createExample(TestedComponent, {}, { ...reducerStatesExample.recoveryAttributeEditing, required_attributes: [ { @@ -89,10 +90,14 @@ export const Recovery = createExample(TestedComponent, { ], } as ReducerState); -export const WithNoRequiredAttribute = createExample(TestedComponent, { - ...reducerStatesExample.backupAttributeEditing, - required_attributes: undefined, -} as ReducerState); +export const WithNoRequiredAttribute = tests.createExample( + TestedComponent, + {}, + { + ...reducerStatesExample.backupAttributeEditing, + required_attributes: undefined, + } as ReducerState, +); const allWidgets = [ "anastasis_gtk_ia_aadhar_in", @@ -123,7 +128,7 @@ function typeForWidget(name: string): string { return "string"; } -export const WithAllPosibleWidget = createExample(TestedComponent, { +export const WithAllPosibleWidget = tests.createExample(TestedComponent, {}, { ...reducerStatesExample.backupAttributeEditing, required_attributes: allWidgets.map((w) => ({ name: w, @@ -134,19 +139,23 @@ export const WithAllPosibleWidget = createExample(TestedComponent, { })), } as ReducerState); -export const WithAutocompleteFeature = createExample(TestedComponent, { - ...reducerStatesExample.backupAttributeEditing, - required_attributes: [ - { - name: "ahv_number", - label: "AHV Number", - type: "string", - uuid: "asdasdsa1", - widget: "wid", - "validation-regex": - "^(756)\\.[0-9]{4}\\.[0-9]{4}\\.[0-9]{2}|(756)[0-9]{10}$", - "validation-logic": "CH_AHV_check", - autocomplete: "???.????.????.??", - }, - ], -} as ReducerState); +export const WithAutocompleteFeature = tests.createExample( + TestedComponent, + {}, + { + ...reducerStatesExample.backupAttributeEditing, + required_attributes: [ + { + name: "ahv_number", + label: "AHV Number", + type: "string", + uuid: "asdasdsa1", + widget: "wid", + "validation-regex": + "^(756)\\.[0-9]{4}\\.[0-9]{4}\\.[0-9]{2}|(756)[0-9]{10}$", + "validation-logic": "CH_AHV_check", + autocomplete: "???.????.????.??", + }, + ], + } as ReducerState, +); |