diff options
Diffstat (limited to 'packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx')
-rw-r--r-- | packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx | 220 |
1 files changed, 104 insertions, 116 deletions
diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx index f7116bf6f..b9dff6363 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx @@ -23,8 +23,9 @@ import { ChallengeFeedbackStatus, ReducerState, } from "@gnu-taler/anastasis-core"; -import { createExample, reducerStatesExample } from "../../../utils/index.js"; +import { reducerStatesExample } from "../../../utils/index.js"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js"; +import { tests } from "@gnu-taler/web-util/lib/index.browser"; export default { title: "Auth method: Question solve", @@ -40,9 +41,12 @@ export default { const type: KnownAuthMethods = "question"; -export const WithoutFeedback = createExample( +export const WithoutFeedback = tests.createExample( TestedComponent[type].solve, { + id: "uuid-1", + }, + { ...reducerStatesExample.challengeSolving, recovery_information: { challenges: [ @@ -56,9 +60,6 @@ export const WithoutFeedback = createExample( }, selected_challenge_uuid: "uuid-1", } as ReducerState, - { - id: "uuid-1", - }, ); const recovery_information = { @@ -72,45 +73,58 @@ const recovery_information = { policies: [], }; -export const CodeInFileFeedback = createExample(TestedComponent[type].solve, { - ...reducerStatesExample.challengeSolving, - recovery_information, - selected_challenge_uuid: "ASDASDSAD!1", - challenge_feedback: { - "ASDASDSAD!1": { - state: ChallengeFeedbackStatus.CodeInFile, - filename: "asd", - display_hint: "hint", +export const CodeInFileFeedback = tests.createExample( + TestedComponent[type].solve, + {}, + { + ...reducerStatesExample.challengeSolving, + recovery_information, + selected_challenge_uuid: "ASDASDSAD!1", + challenge_feedback: { + "ASDASDSAD!1": { + state: ChallengeFeedbackStatus.CodeInFile, + filename: "asd", + display_hint: "hint", + }, }, - }, -} as ReducerState); - -export const CodeSentFeedback = createExample(TestedComponent[type].solve, { - ...reducerStatesExample.challengeSolving, - recovery_information, - selected_challenge_uuid: "ASDASDSAD!1", - challenge_feedback: { - "ASDASDSAD!1": { - state: ChallengeFeedbackStatus.CodeSent, - address_hint: "asdasd", - display_hint: "qweqweqw", + } as ReducerState, +); + +export const CodeSentFeedback = tests.createExample( + TestedComponent[type].solve, + {}, + { + ...reducerStatesExample.challengeSolving, + recovery_information, + selected_challenge_uuid: "ASDASDSAD!1", + challenge_feedback: { + "ASDASDSAD!1": { + state: ChallengeFeedbackStatus.CodeSent, + address_hint: "asdasd", + display_hint: "qweqweqw", + }, }, - }, -} as ReducerState); - -export const SolvedFeedback = createExample(TestedComponent[type].solve, { - ...reducerStatesExample.challengeSolving, - recovery_information, - selected_challenge_uuid: "ASDASDSAD!1", - challenge_feedback: { - "ASDASDSAD!1": { - state: ChallengeFeedbackStatus.Solved, + } as ReducerState, +); + +export const SolvedFeedback = tests.createExample( + TestedComponent[type].solve, + {}, + { + ...reducerStatesExample.challengeSolving, + recovery_information, + selected_challenge_uuid: "ASDASDSAD!1", + challenge_feedback: { + "ASDASDSAD!1": { + state: ChallengeFeedbackStatus.Solved, + }, }, - }, -} as ReducerState); + } as ReducerState, +); -export const ServerFailureFeedback = createExample( +export const ServerFailureFeedback = tests.createExample( TestedComponent[type].solve, + {}, { ...reducerStatesExample.challengeSolving, recovery_information, @@ -124,45 +138,58 @@ export const ServerFailureFeedback = createExample( } as ReducerState, ); -export const TruthUnknownFeedback = createExample(TestedComponent[type].solve, { - ...reducerStatesExample.challengeSolving, - recovery_information, - selected_challenge_uuid: "ASDASDSAD!1", - challenge_feedback: { - "ASDASDSAD!1": { - state: ChallengeFeedbackStatus.TruthUnknown, +export const TruthUnknownFeedback = tests.createExample( + TestedComponent[type].solve, + {}, + { + ...reducerStatesExample.challengeSolving, + recovery_information, + selected_challenge_uuid: "ASDASDSAD!1", + challenge_feedback: { + "ASDASDSAD!1": { + state: ChallengeFeedbackStatus.TruthUnknown, + }, }, - }, -} as ReducerState); - -export const TalerPaymentFeedback = createExample(TestedComponent[type].solve, { - ...reducerStatesExample.challengeSolving, - recovery_information, - selected_challenge_uuid: "ASDASDSAD!1", - challenge_feedback: { - "ASDASDSAD!1": { - state: ChallengeFeedbackStatus.TalerPayment, - payment_secret: "secret", - provider: "asdasdas", - taler_pay_uri: "taler://pay/...", + } as ReducerState, +); + +export const TalerPaymentFeedback = tests.createExample( + TestedComponent[type].solve, + {}, + { + ...reducerStatesExample.challengeSolving, + recovery_information, + selected_challenge_uuid: "ASDASDSAD!1", + challenge_feedback: { + "ASDASDSAD!1": { + state: ChallengeFeedbackStatus.TalerPayment, + payment_secret: "secret", + provider: "asdasdas", + taler_pay_uri: "taler://pay/...", + }, }, - }, -} as ReducerState); - -export const UnsupportedFeedback = createExample(TestedComponent[type].solve, { - ...reducerStatesExample.challengeSolving, - recovery_information, - selected_challenge_uuid: "ASDASDSAD!1", - challenge_feedback: { - "ASDASDSAD!1": { - state: ChallengeFeedbackStatus.Unsupported, - unsupported_method: "method", + } as ReducerState, +); + +export const UnsupportedFeedback = tests.createExample( + TestedComponent[type].solve, + {}, + { + ...reducerStatesExample.challengeSolving, + recovery_information, + selected_challenge_uuid: "ASDASDSAD!1", + challenge_feedback: { + "ASDASDSAD!1": { + state: ChallengeFeedbackStatus.Unsupported, + unsupported_method: "method", + }, }, - }, -} as ReducerState); + } as ReducerState, +); -export const RateLimitExceededFeedback = createExample( +export const RateLimitExceededFeedback = tests.createExample( TestedComponent[type].solve, + {}, { ...reducerStatesExample.challengeSolving, recovery_information, @@ -175,8 +202,9 @@ export const RateLimitExceededFeedback = createExample( } as ReducerState, ); -export const IbanInstructionsFeedback = createExample( +export const IbanInstructionsFeedback = tests.createExample( TestedComponent[type].solve, + {}, { ...reducerStatesExample.challengeSolving, recovery_information, @@ -194,8 +222,9 @@ export const IbanInstructionsFeedback = createExample( } as ReducerState, ); -export const IncorrectAnswerFeedback = createExample( +export const IncorrectAnswerFeedback = tests.createExample( TestedComponent[type].solve, + {}, { ...reducerStatesExample.challengeSolving, recovery_information, @@ -207,44 +236,3 @@ export const IncorrectAnswerFeedback = createExample( }, } as ReducerState, ); - -// export const AuthIbanFeedback = createExample(TestedComponent[type].solve, { -// ...reducerStatesExample.challengeSolving, -// recovery_information: { -// challenges: [ -// { -// instructions: "does P equals NP?", -// type: "question", -// uuid: "ASDASDSAD!1", -// }, -// ], -// policies: [], -// }, -// selected_challenge_uuid: "ASDASDSAD!1", -// challenge_feedback: { -// "ASDASDSAD!1": ibanFeedback, -// }, -// } as ReducerState); - -// export const PaymentFeedback = createExample(TestedComponent[type].solve, { -// ...reducerStatesExample.challengeSolving, -// recovery_information: { -// challenges: [ -// { -// instructions: "does P equals NP?", -// type: "question", -// uuid: "ASDASDSAD!1", -// }, -// ], -// policies: [], -// }, -// selected_challenge_uuid: "ASDASDSAD!1", -// challenge_feedback: { -// "ASDASDSAD!1": { -// state: ChallengeFeedbackStatus.TalerPayment, -// taler_pay_uri: "taler://pay/...", -// provider: "https://localhost:8080/", -// payment_secret: "3P4561HAMHRRYEYD6CM6J7TS5VTD5SR2K2EXJDZEFSX92XKHR4KG", -// }, -// }, -// } as ReducerState); |