aboutsummaryrefslogtreecommitdiff
path: root/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-11-03 18:26:57 +0100
committerFlorian Dold <florian@dold.me>2021-11-03 18:26:57 +0100
commit7d24d2254b49010eb0e6e6af54a0f381cfdc4b53 (patch)
treeaa3a8beb1807ff186a648aa23769c3811a7a635e /packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx
parent04356cd23fef76d2020338d2b2b394095fdc2b14 (diff)
downloadwallet-core-7d24d2254b49010eb0e6e6af54a0f381cfdc4b53.tar.xz
anastasis-webui: make it compile again
Diffstat (limited to 'packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx')
-rw-r--r--packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx339
1 files changed, 161 insertions, 178 deletions
diff --git a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx
index a89b5640c..48115c798 100644
--- a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx
+++ b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx
@@ -16,218 +16,201 @@
*/
/**
-*
-* @author Sebastian Javier Marchano (sebasjm)
-*/
-
-import { RecoveryStates, ReducerState } from 'anastasis-core';
-import { createExample, reducerStatesExample } from '../../utils';
-import { ChallengeOverviewScreen as TestedComponent } from './ChallengeOverviewScreen';
+ *
+ * @author Sebastian Javier Marchano (sebasjm)
+ */
+import { RecoveryStates, ReducerState } from "anastasis-core";
+import { createExample, reducerStatesExample } from "../../utils";
+import { ChallengeOverviewScreen as TestedComponent } from "./ChallengeOverviewScreen";
export default {
- title: 'Pages/recovery/ChallengeOverviewScreen',
+ title: "Pages/recovery/ChallengeOverviewScreen",
component: TestedComponent,
args: {
order: 5,
},
argTypes: {
- onUpdate: { action: 'onUpdate' },
- onBack: { action: 'onBack' },
+ onUpdate: { action: "onUpdate" },
+ onBack: { action: "onBack" },
},
};
export const OneUnsolvedPolicy = createExample(TestedComponent, {
...reducerStatesExample.challengeSelecting,
recovery_information: {
- policies: [[{ uuid: '1' }]],
- challenges: [{
- cost: 'USD:1',
- instructions: 'just go for it',
- type: 'question',
- uuid: '1',
- }]
+ policies: [[{ uuid: "1" }]],
+ challenges: [
+ {
+ cost: "USD:1",
+ instructions: "just go for it",
+ type: "question",
+ uuid: "1",
+ },
+ ],
},
} as ReducerState);
export const SomePoliciesOneSolved = createExample(TestedComponent, {
...reducerStatesExample.challengeSelecting,
recovery_information: {
- policies: [[{ uuid: '1' }, { uuid: '2' }], [{ uuid: 'uuid-3' }]],
- challenges: [{
- cost: 'USD:1',
- instructions: 'this question cost 1 USD',
- type: 'question',
- uuid: '1',
- }, {
- cost: 'USD:0',
- instructions: 'answering this question is free',
- type: 'question',
- uuid: '2',
- }, {
- cost: 'USD:1',
- instructions: 'this question is already answered',
- type: 'question',
- uuid: 'uuid-3',
- }]
+ policies: [[{ uuid: "1" }, { uuid: "2" }], [{ uuid: "uuid-3" }]],
+ challenges: [
+ {
+ cost: "USD:1",
+ instructions: "this question cost 1 USD",
+ type: "question",
+ uuid: "1",
+ },
+ {
+ cost: "USD:0",
+ instructions: "answering this question is free",
+ type: "question",
+ uuid: "2",
+ },
+ {
+ cost: "USD:1",
+ instructions: "this question is already answered",
+ type: "question",
+ uuid: "uuid-3",
+ },
+ ],
},
challenge_feedback: {
- 'uuid-3': {
- state: 'solved'
- }
+ "uuid-3": {
+ state: "solved",
+ },
},
} as ReducerState);
export const OneBadConfiguredPolicy = createExample(TestedComponent, {
...reducerStatesExample.challengeSelecting,
recovery_information: {
- policies: [[{ uuid: '1' }, { uuid: '2' }]],
- challenges: [{
- cost: 'USD:1',
- instructions: 'this policy has a missing uuid (the other auth method)',
- type: 'totp',
- uuid: '1',
- }],
+ policies: [[{ uuid: "1" }, { uuid: "2" }]],
+ challenges: [
+ {
+ cost: "USD:1",
+ instructions: "this policy has a missing uuid (the other auth method)",
+ type: "totp",
+ uuid: "1",
+ },
+ ],
},
} 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: [{
- cost: 'USD:1',
- instructions: 'Does P equals NP?',
- type: 'question',
- uuid: '1',
- },{
- cost: 'USD:1',
- instructions: 'SMS to 555-555',
- type: 'sms',
- uuid: '2',
- },{
- cost: 'USD:1',
- instructions: 'Email to qwe@asd.com',
- type: 'email',
- uuid: '3',
- },{
- cost: 'USD:1',
- instructions: 'Enter 8 digits code for "Anastasis"',
- type: 'totp',
- uuid: '4',
- },{//
- cost: 'USD:0',
- instructions: 'Wire transfer from ASDXCVQWE123123 with holder Florian',
- type: 'iban',
- uuid: '5',
- },{
- cost: 'USD:1',
- instructions: 'Join a video call',
- type: 'video',//Enter 8 digits code for "Anastasis"
- uuid: '7',
- },{
- },{
- cost: 'USD:1',
- instructions: 'Letter to address in postal code DE123123',
- type: 'post',//Enter 8 digits code for "Anastasis"
- uuid: '8',
- },{
- cost: 'USD:1',
- instructions: 'instruction for an unknown type of challenge',
- type: 'new-type-of-challenge',
- uuid: '6',
- }],
+ policies: [
+ [
+ { uuid: "1" },
+ { uuid: "2" },
+ { uuid: "3" },
+ { uuid: "4" },
+ { uuid: "5" },
+ { uuid: "6" },
+ { uuid: "7" },
+ { uuid: "8" },
+ ],
+ ],
+ challenges: [
+ {
+ cost: "USD:1",
+ instructions: "Does P equals NP?",
+ type: "question",
+ uuid: "1",
+ },
+ {
+ cost: "USD:1",
+ instructions: "SMS to 555-555",
+ type: "sms",
+ uuid: "2",
+ },
+ {
+ cost: "USD:1",
+ instructions: "Email to qwe@asd.com",
+ type: "email",
+ uuid: "3",
+ },
+ {
+ cost: "USD:1",
+ instructions: 'Enter 8 digits code for "Anastasis"',
+ type: "totp",
+ uuid: "4",
+ },
+ {
+ //
+ cost: "USD:0",
+ instructions: "Wire transfer from ASDXCVQWE123123 with holder Florian",
+ type: "iban",
+ uuid: "5",
+ },
+ {
+ cost: "USD:1",
+ instructions: "Join a video call",
+ type: "video", //Enter 8 digits code for "Anastasis"
+ uuid: "7",
+ },
+ {},
+ {
+ cost: "USD:1",
+ instructions: "Letter to address in postal code DE123123",
+ type: "post", //Enter 8 digits code for "Anastasis"
+ uuid: "8",
+ },
+ {
+ cost: "USD:1",
+ instructions: "instruction for an unknown type of challenge",
+ type: "new-type-of-challenge",
+ uuid: "6",
+ },
+ ],
},
} as ReducerState);
-
-export const OnePolicyWithAllTheChallengesInDifferentState = createExample(TestedComponent, {
- ...reducerStatesExample.challengeSelecting,
- recovery_information: {
- policies: [[
- { uuid: '1' },
- { uuid: '2' },
- { uuid: '3' },
- { uuid: '4' },
- { uuid: '5' },
- { uuid: '6' },
- { uuid: '7' },
- { uuid: '8' },
- { uuid: '9' },
- { uuid: '10' },
- ]],
- challenges: [{
- cost: 'USD:1',
- instructions: 'in state "solved"',
- type: 'question',
- uuid: '1',
- },{
- cost: 'USD:1',
- instructions: 'in state "hint"',
- type: 'question',
- uuid: '2',
- },{
- cost: 'USD:1',
- instructions: 'in state "details"',
- type: 'question',
- uuid: '3',
- },{
- cost: 'USD:1',
- instructions: 'in state "body"',
- type: 'question',
- uuid: '4',
- },{
- cost: 'USD:1',
- instructions: 'in state "redirect"',
- type: 'question',
- uuid: '5',
- },{
- cost: 'USD:1',
- instructions: 'in state "server-failure"',
- type: 'question',
- uuid: '6',
- },{
- cost: 'USD:1',
- instructions: 'in state "truth-unknown"',
- type: 'question',
- uuid: '7',
- },{
- cost: 'USD:1',
- instructions: 'in state "rate-limit-exceeded"',
- type: 'question',
- uuid: '8',
- },{
- cost: 'USD:1',
- instructions: 'in state "authentication-timeout"',
- type: 'question',
- uuid: '9',
- },{
- cost: 'USD:1',
- instructions: 'in state "external-instructions"',
- type: 'question',
- uuid: '10',
- }],
- },
- challenge_feedback: {
- 1: { state: 'solved' },
- 2: { state: 'hint' },
- 3: { state: 'details' },
- 4: { state: 'body' },
- 5: { state: 'redirect' },
- 6: { state: 'server-failure' },
- 7: { state: 'truth-unknown' },
- 8: { state: 'rate-limit-exceeded' },
- 9: { state: 'authentication-timeout' },
- 10: { state: 'external-instructions' },
- }
-} as ReducerState);
-export const NoPolicies = createExample(TestedComponent, reducerStatesExample.challengeSelecting);
+export const OnePolicyWithAllTheChallengesInDifferentState = createExample(
+ TestedComponent,
+ {
+ ...reducerStatesExample.challengeSelecting,
+ recovery_state: RecoveryStates.ChallengeSelecting,
+ recovery_information: {
+ policies: [
+ [
+ { uuid: "1" },
+ { uuid: "2" },
+ { uuid: "3" },
+ { uuid: "4" },
+ { uuid: "5" },
+ { uuid: "6" },
+ { uuid: "7" },
+ { uuid: "8" },
+ { uuid: "9" },
+ { uuid: "10" },
+ ],
+ ],
+ challenges: [
+ {
+ cost: "USD:1",
+ instructions: 'in state "solved"',
+ type: "question",
+ uuid: "1",
+ },
+ {
+ cost: "USD:1",
+ instructions: 'in state "message"',
+ type: "question",
+ uuid: "2",
+ },
+ ],
+ },
+ challenge_feedback: {
+ 1: { state: "solved" },
+ 2: { state: "message", message: "Security question was not solved correctly" },
+ // FIXME: add missing feedback states here!
+ },
+ } as ReducerState,
+);
+export const NoPolicies = createExample(
+ TestedComponent,
+ reducerStatesExample.challengeSelecting,
+);