Skip to content

Commit

Permalink
test for phone verification
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Feb 1, 2024
1 parent 311f2b0 commit 6f66197
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export default function (server: Server, ctx: AppContext) {
}
if (
ctx.cfg.phoneVerification.bypassPhoneNumber &&
ctx.cfg.phoneVerification.bypassPhoneNumber === input.body.phoneNumber
ctx.cfg.phoneVerification.bypassPhoneNumber ===
input.body.phoneNumber.trim()
) {
return
}
Expand Down
6 changes: 6 additions & 0 deletions packages/pds/tests/phone-verification.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe('phone verification', () => {
twilioAccountSid: 'ACXXXXXXX',
twilioAuthToken: 'AUTH',
twilioServiceSid: 'VAXXXXXXXX',
bypassPhoneNumber: '+10000000000',
},
})
ctx = network.pds.ctx
Expand Down Expand Up @@ -153,6 +154,11 @@ describe('phone verification', () => {
)
})

it('bypasses phone number verification', async () => {
await requestCode('+10000000000')
await createAccountWithCode('+10000000000')
})

it('normalizes phone numbers', async () => {
const code1 = await requestCode('+1 (444)444-4444')
expect(verificationCodes['+14444444444']).toEqual(code1)
Expand Down

0 comments on commit 6f66197

Please sign in to comment.