diff options
author | Sebastian <sebasjm@gmail.com> | 2022-08-26 12:59:00 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-08-26 12:59:09 -0300 |
commit | cf894f1dd309e48d8be380c56175219027c84fb7 (patch) | |
tree | 8aa434c47d4ed366f4b3d5f0bd89fc696a388b9d /packages/anastasis-webui/src/pages/home/authMethod | |
parent | eef2d4702019b9de64efc01fff097b437e65ce39 (diff) | |
download | wallet-core-cf894f1dd309e48d8be380c56175219027c84fb7.tar.xz |
fix #7065
Diffstat (limited to 'packages/anastasis-webui/src/pages/home/authMethod')
-rw-r--r-- | packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx | 251 |
1 files changed, 149 insertions, 102 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 038d5e897..182538775 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx @@ -20,7 +20,6 @@ */ import { - ChallengeFeedbackBankTransferRequired, ChallengeFeedbackStatus, ReducerState, } from "@gnu-taler/anastasis-core"; @@ -61,142 +60,190 @@ export const WithoutFeedback = createExample( }, ); -export const ServerFailureFeedback = createExample( - TestedComponent[type].solve, - { - ...reducerStatesExample.challengeSolving, - recovery_information: { - challenges: [ - { - instructions: "does P equal NP?", - type: "question", - uuid: "ASDASDSAD!1", - }, - ], - policies: [], +const recovery_information = { + challenges: [ + { + instructions: "does P equal NP?", + type: "question", + uuid: "ASDASDSAD!1", }, - selected_challenge_uuid: "ASDASDSAD!1", - challenge_feedback: { - "ASDASDSAD!1": { - state: ChallengeFeedbackStatus.ServerFailure, - http_status: 500, - error_response: "Couldn't connect to mysql", - }, + ], + 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", }, - } as ReducerState, -); + }, +} as ReducerState); -export const MessageRateLimitExceededFeedback = createExample( +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 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 ServerFailureFeedback = createExample( TestedComponent[type].solve, { ...reducerStatesExample.challengeSolving, - recovery_information: { - challenges: [ - { - instructions: "does P equals NP?", - type: "question", - uuid: "ASDASDSAD!1", - }, - ], - policies: [], - }, + recovery_information, selected_challenge_uuid: "ASDASDSAD!1", challenge_feedback: { "ASDASDSAD!1": { - state: ChallengeFeedbackStatus.RateLimitExceeded, + state: ChallengeFeedbackStatus.ServerFailure, + http_status: 500, }, }, } as ReducerState, ); -export const UnsupportedFeedback = createExample(TestedComponent[type].solve, { +export const TruthUnknownFeedback = createExample(TestedComponent[type].solve, { ...reducerStatesExample.challengeSolving, - recovery_information: { - challenges: [ - { - instructions: "does P equals NP?", - type: "question", - uuid: "ASDASDSAD!1", - }, - ], - policies: [], - }, + recovery_information, selected_challenge_uuid: "ASDASDSAD!1", challenge_feedback: { "ASDASDSAD!1": { - state: ChallengeFeedbackStatus.Unsupported, - http_status: 500, - unsupported_method: "Question", + state: ChallengeFeedbackStatus.TruthUnknown, }, }, } as ReducerState); -export const TruthUnknownFeedback = createExample(TestedComponent[type].solve, { +export const TalerPaymentFeedback = createExample(TestedComponent[type].solve, { ...reducerStatesExample.challengeSolving, - recovery_information: { - challenges: [ - { - instructions: "does P equals NP?", - type: "question", - uuid: "ASDASDSAD!1", - }, - ], - policies: [], - }, + recovery_information, selected_challenge_uuid: "ASDASDSAD!1", challenge_feedback: { "ASDASDSAD!1": { - state: ChallengeFeedbackStatus.TruthUnknown, + state: ChallengeFeedbackStatus.TalerPayment, + payment_secret: "secret", + provider: "asdasdas", + taler_pay_uri: "taler://pay/...", }, }, } as ReducerState); -const ibanFeedback: ChallengeFeedbackBankTransferRequired = { - state: ChallengeFeedbackStatus.IbanInstructions, - challenge_amount: "EUR:1", - target_iban: "DE12345789000", - target_business_name: "Data Loss Incorporated", - wire_transfer_subject: "Anastasis 987654321", - answer_code: 987654321, -}; - -export const AuthIbanFeedback = createExample(TestedComponent[type].solve, { +export const UnsupportedFeedback = createExample(TestedComponent[type].solve, { ...reducerStatesExample.challengeSolving, - recovery_information: { - challenges: [ - { - instructions: "does P equals NP?", - type: "question", - uuid: "ASDASDSAD!1", - }, - ], - policies: [], - }, + recovery_information, selected_challenge_uuid: "ASDASDSAD!1", challenge_feedback: { - "ASDASDSAD!1": ibanFeedback, + "ASDASDSAD!1": { + state: ChallengeFeedbackStatus.Unsupported, + unsupported_method: "method", + }, }, } as ReducerState); -export const PaymentFeedback = createExample(TestedComponent[type].solve, { - ...reducerStatesExample.challengeSolving, - recovery_information: { - challenges: [ - { - instructions: "does P equals NP?", - type: "question", - uuid: "ASDASDSAD!1", +export const RateLimitExceededFeedback = createExample( + TestedComponent[type].solve, + { + ...reducerStatesExample.challengeSolving, + recovery_information, + selected_challenge_uuid: "ASDASDSAD!1", + challenge_feedback: { + "ASDASDSAD!1": { + state: ChallengeFeedbackStatus.RateLimitExceeded, }, - ], - 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); + } as ReducerState, +); + +export const IbanInstructionsFeedback = createExample( + TestedComponent[type].solve, + { + ...reducerStatesExample.challengeSolving, + recovery_information, + selected_challenge_uuid: "ASDASDSAD!1", + challenge_feedback: { + "ASDASDSAD!1": { + state: ChallengeFeedbackStatus.IbanInstructions, + challenge_amount: "EUR:1", + target_iban: "DE12345789000", + target_business_name: "Data Loss Incorporated", + wire_transfer_subject: "Anastasis 987654321", + answer_code: 987654321, + }, + }, + } as ReducerState, +); + +export const IncorrectAnswerFeedback = createExample( + TestedComponent[type].solve, + { + ...reducerStatesExample.challengeSolving, + recovery_information, + selected_challenge_uuid: "ASDASDSAD!1", + challenge_feedback: { + "ASDASDSAD!1": { + state: ChallengeFeedbackStatus.IncorrectAnswer, + }, + }, + } 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); |