summaryrefslogtreecommitdiff
path: root/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-04-21 10:47:47 -0300
committerSebastian <sebasjm@gmail.com>2023-04-21 10:47:47 -0300
commitf470f167e32d8f7775ad994f09afb1d353b0b300 (patch)
tree3a1f2a040bb09d6639c81436b90b416fb8044f91 /packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx
parent6dcc488a2c8fd681941e5d3b62bb04af7669888e (diff)
downloadwallet-core-f470f167e32d8f7775ad994f09afb1d353b0b300.tar.gz
wallet-core-f470f167e32d8f7775ad994f09afb1d353b0b300.tar.bz2
wallet-core-f470f167e32d8f7775ad994f09afb1d353b0b300.zip
integrate anastasis to the web-utils testing api
Diffstat (limited to 'packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx')
-rw-r--r--packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx145
1 files changed, 75 insertions, 70 deletions
diff --git a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx
index d2471755a..f41f894e8 100644
--- a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx
+++ b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx
@@ -24,8 +24,9 @@ import {
RecoveryStates,
ReducerState,
} from "@gnu-taler/anastasis-core";
-import { createExample, reducerStatesExample } from "../../utils/index.js";
+import { reducerStatesExample } from "../../utils/index.js";
import { ChallengeOverviewScreen as TestedComponent } from "./ChallengeOverviewScreen.js";
+import { tests } from "@gnu-taler/web-util/lib/index.browser";
export default {
title: "Challenge overview",
@@ -39,7 +40,7 @@ export default {
},
};
-export const OneUnsolvedPolicy = createExample(TestedComponent, {
+export const OneUnsolvedPolicy = tests.createExample(TestedComponent, {}, {
...reducerStatesExample.challengeSelecting,
recovery_information: {
policies: [[{ uuid: "1" }]],
@@ -53,7 +54,7 @@ export const OneUnsolvedPolicy = createExample(TestedComponent, {
},
} as ReducerState);
-export const SomePoliciesOneSolved = createExample(TestedComponent, {
+export const SomePoliciesOneSolved = tests.createExample(TestedComponent, {}, {
...reducerStatesExample.challengeSelecting,
recovery_information: {
policies: [[{ uuid: "1" }, { uuid: "2" }], [{ uuid: "uuid-3" }]],
@@ -82,7 +83,7 @@ export const SomePoliciesOneSolved = createExample(TestedComponent, {
},
} as ReducerState);
-export const OneBadConfiguredPolicy = createExample(TestedComponent, {
+export const OneBadConfiguredPolicy = tests.createExample(TestedComponent, {}, {
...reducerStatesExample.challengeSelecting,
recovery_information: {
policies: [[{ uuid: "1" }, { uuid: "2" }]],
@@ -96,72 +97,76 @@ export const OneBadConfiguredPolicy = createExample(TestedComponent, {
},
} as ReducerState);
-export const OnePolicyWithAllTheChallenges = createExample(TestedComponent, {
- ...reducerStatesExample.challengeSelecting,
- recovery_information: {
- policies: [
- [
- { uuid: "1" },
- { uuid: "2" },
- { uuid: "3" },
- { uuid: "4" },
- { uuid: "5" },
- { uuid: "6" },
- { uuid: "7" },
- { uuid: "8" },
- ],
- ],
- challenges: [
- {
- instructions: "Does P equals NP?",
- type: "question",
- uuid: "1",
- },
- {
- instructions: "SMS to 555-555",
- type: "sms",
- uuid: "2",
- },
- {
- instructions: "Email to qwe@asd.com",
- type: "email",
- uuid: "3",
- },
- {
- instructions: 'Enter 8 digits code for "Anastasis"',
- type: "totp",
- uuid: "4",
- },
- {
- //
- instructions: "Wire transfer from ASDXCVQWE123123 with holder Florian",
- type: "iban",
- uuid: "5",
- },
- {
- instructions: "Join a video call",
- type: "video", //Enter 8 digits code for "Anastasis"
- uuid: "7",
- },
- {},
- {
- instructions: "Letter to address in postal code DE123123",
- type: "post", //Enter 8 digits code for "Anastasis"
- uuid: "8",
- },
- {
- instructions: "instruction for an unknown type of challenge",
- type: "new-type-of-challenge",
- uuid: "6",
- },
- ],
- },
-} as ReducerState);
-
-export const OnePolicyWithAllTheChallengesInDifferentState = createExample(
+export const OnePolicyWithAllTheChallenges = tests.createExample(
TestedComponent,
+ {},
{
...reducerStatesExample.challengeSelecting,
+ recovery_information: {
+ policies: [
+ [
+ { uuid: "1" },
+ { uuid: "2" },
+ { uuid: "3" },
+ { uuid: "4" },
+ { uuid: "5" },
+ { uuid: "6" },
+ { uuid: "7" },
+ { uuid: "8" },
+ ],
+ ],
+ challenges: [
+ {
+ instructions: "Does P equals NP?",
+ type: "question",
+ uuid: "1",
+ },
+ {
+ instructions: "SMS to 555-555",
+ type: "sms",
+ uuid: "2",
+ },
+ {
+ instructions: "Email to qwe@asd.com",
+ type: "email",
+ uuid: "3",
+ },
+ {
+ instructions: 'Enter 8 digits code for "Anastasis"',
+ type: "totp",
+ uuid: "4",
+ },
+ {
+ //
+ instructions:
+ "Wire transfer from ASDXCVQWE123123 with holder Florian",
+ type: "iban",
+ uuid: "5",
+ },
+ {
+ instructions: "Join a video call",
+ type: "video", //Enter 8 digits code for "Anastasis"
+ uuid: "7",
+ },
+ {},
+ {
+ instructions: "Letter to address in postal code DE123123",
+ type: "post", //Enter 8 digits code for "Anastasis"
+ uuid: "8",
+ },
+ {
+ instructions: "instruction for an unknown type of challenge",
+ type: "new-type-of-challenge",
+ uuid: "6",
+ },
+ ],
+ },
+ } as ReducerState,
+);
+
+export const OnePolicyWithAllTheChallengesInDifferentState =
+ tests.createExample(TestedComponent, {}, {
+ ...reducerStatesExample.challengeSelecting,
recovery_state: RecoveryStates.ChallengeSelecting,
recovery_information: {
policies: [
@@ -258,9 +263,9 @@ export const OnePolicyWithAllTheChallengesInDifferentState = createExample(
},
"uuid-10": { state: ChallengeFeedbackStatus.IncorrectAnswer.toString() },
},
- } as ReducerState,
-);
-export const NoPolicies = createExample(
+ } as ReducerState);
+export const NoPolicies = tests.createExample(
TestedComponent,
+ {},
reducerStatesExample.challengeSelecting,
);