First steps towards the SAS partnership * otp flow now pretends to do the linking * Update LinkAccountForm header * Update redirect times * Clean up comments * Set maxAge on sas cookies * make all SAS routes protected * Merge remote-tracking branch 'refs/remotes/origin/feature/sas-login' into feature/sas-login * Require auth for sas link flow * Fix resend otp * Add error support to OneTimePasswordForm * Add Sentry to SAS error boundary * Move SAS_REQUEST_OTP_STATE_STORAGE_COOKIE_NAME * Add missing translations * Merge branch 'master' of bitbucket.org:scandic-swap/web into feature/sas-login * Merge branch 'feature/sas-login' of bitbucket.org:scandic-swap/web into feature/sas-login * Add TooManyCodesError component * Refactor GenericError to support new errors * Add FailedAttemptsError * remove removed component <VWOScript/> * Merge branch 'feature/sas-login' of bitbucket.org:scandic-swap/web into feature/sas-login * remove local cookie-bot reference * Fix sas campaign logo scaling * feature toggle the SAS stuff * Merge branch 'feature/sas-login' of bitbucket.org:scandic-swap/web into feature/sas-login * fix: use env vars for SAS endpoints Approved-by: Linus Flood
38 lines
1004 B
TypeScript
38 lines
1004 B
TypeScript
import { describe, expect, it } from "@jest/globals"
|
|
|
|
import { parseSASRequestOtpError } from "./requestOtpError"
|
|
|
|
describe("requestOtpError", () => {
|
|
it("parses error with invalid error code", () => {
|
|
const error = {
|
|
status: "status",
|
|
error: "error",
|
|
errorCode: "a",
|
|
databaseUUID: "9ffefefe-df0e-4229-9792-5ed31bef1db4",
|
|
}
|
|
|
|
const actual = parseSASRequestOtpError({
|
|
status: "status",
|
|
error: "error",
|
|
errorCode: "a" as unknown as number,
|
|
databaseUUID: "9ffefefe-df0e-4229-9792-5ed31bef1db4",
|
|
} as any)
|
|
expect(actual).toEqual({
|
|
errorCode: "UNKNOWN",
|
|
})
|
|
})
|
|
|
|
it("parses error as TOO_MANY_REQUESTS error code", () => {
|
|
const actual = parseSASRequestOtpError({
|
|
status: "status",
|
|
error: "error",
|
|
errorCode: 10,
|
|
databaseUUID: "9ffefefe-df0e-4229-9792-5ed31bef1db4",
|
|
otpExpiration: "2021-09-01T00:00:00Z",
|
|
})
|
|
expect(actual).toEqual({
|
|
errorCode: "TOO_MANY_REQUESTS",
|
|
})
|
|
})
|
|
})
|