Skip to content

Commit

Permalink
ban 0 for short public key test cases to stop AbortOnZeroSrpError cau…
Browse files Browse the repository at this point in the history
…sing flaking tests
  • Loading branch information
Simon McAllister authored and Simon McAllister committed Mar 12, 2024
1 parent 93ca42f commit 59fd456
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/__tests__/test-cases/initiate-auth-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export const positiveInitiateAuthResponses: Record<string, InitiateAuthResponse>
largeBShort: mockInitiateAuthResponseFactory({
ChallengeParameters: {
...ChallengeParameters,
SRP_B: faker.random.alphaNumeric(1, { casing: "lower" }),
// 1 / 62 chance to return "0" which will trigger a AbortOnZeroBSrpError, so ban the char
SRP_B: faker.random.alphaNumeric(1, { casing: "lower", bannedChars: "0" }),
},
}),
largeBLong: mockInitiateAuthResponseFactory({
Expand Down
6 changes: 4 additions & 2 deletions src/__tests__/test-cases/srp-sessions-signed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export const positiveSrpSessionsSigned: Record<string, SrpSessionSigned> = {
largeA: faker.random.alphaNumeric(1024, { casing: "lower" }),
}),
largeAShort: mockSrpSessionSignedFactory({
largeA: faker.random.alphaNumeric(1, { casing: "lower" }),
// 1 / 62 chance to return "0" which will trigger a AbortOnZeroASrpError, so ban the char
largeA: faker.random.alphaNumeric(1, { casing: "lower", bannedChars: "0" }),
}),
largeALong: mockSrpSessionSignedFactory({
largeA: faker.random.alphaNumeric(10000, { casing: "lower" }),
Expand All @@ -100,7 +101,8 @@ export const positiveSrpSessionsSigned: Record<string, SrpSessionSigned> = {
largeB: faker.random.alphaNumeric(1024, { casing: "lower" }),
}),
largeBShort: mockSrpSessionSignedFactory({
largeB: faker.random.alphaNumeric(1, { casing: "lower" }),
// 1 / 62 chance to return "0" which will trigger a AbortOnZeroBSrpError, so ban the char
largeB: faker.random.alphaNumeric(1, { casing: "lower", bannedChars: "0" }),
}),
largeBLarge: mockSrpSessionSignedFactory({
largeB: faker.random.alphaNumeric(10000, { casing: "lower" }),
Expand Down
3 changes: 2 additions & 1 deletion src/__tests__/test-cases/srp-sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ export const positiveSrpSessions: Record<string, SrpSession> = {
largeA: faker.random.alphaNumeric(1024, { casing: "lower" }),
}),
largeAShort: mockSrpSessionFactory({
largeA: faker.random.alphaNumeric(1, { casing: "lower" }),
// 1 / 62 chance to return "0" which will trigger a AbortOnZeroASrpError, so ban the char
largeA: faker.random.alphaNumeric(1, { casing: "lower", bannedChars: "0" }),
}),
largeALong: mockSrpSessionFactory({
largeA: faker.random.alphaNumeric(10000, { casing: "lower" }),
Expand Down

0 comments on commit 59fd456

Please sign in to comment.