diff options
Diffstat (limited to 'packages/server/src/assertion/generateAssertionOptions.test.ts')
-rw-r--r-- | packages/server/src/assertion/generateAssertionOptions.test.ts | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/packages/server/src/assertion/generateAssertionOptions.test.ts b/packages/server/src/assertion/generateAssertionOptions.test.ts index 257657b..aa345af 100644 --- a/packages/server/src/assertion/generateAssertionOptions.test.ts +++ b/packages/server/src/assertion/generateAssertionOptions.test.ts @@ -3,40 +3,41 @@ import generateAssertionOptions from './generateAssertionOptions'; test('should generate credential request options suitable for sending via JSON', () => { const challenge = 'totallyrandomvalue'; - const options = generateAssertionOptions( + const options = generateAssertionOptions({ challenge, - 1, - [ + timeout: 1, + allowedBase64CredentialIDs: [ Buffer.from('1234', 'ascii').toString('base64'), Buffer.from('5678', 'ascii').toString('base64'), ], - ); + }); expect(options).toEqual({ - publicKey: { - challenge, - allowCredentials: [ - { - id: 'MTIzNA==', - type: 'public-key', - transports: ['usb', 'ble', 'nfc', 'internal'], - }, - { - id: 'NTY3OA==', - type: 'public-key', - transports: ['usb', 'ble', 'nfc', 'internal'], - }, - ], - timeout: 1, - }, + challenge, + allowCredentials: [ + { + id: 'MTIzNA==', + type: 'public-key', + transports: ['usb', 'ble', 'nfc', 'internal'], + }, + { + id: 'NTY3OA==', + type: 'public-key', + transports: ['usb', 'ble', 'nfc', 'internal'], + }, + ], + timeout: 1, }); }); test('defaults to 60 seconds if no timeout is specified', () => { - const options = generateAssertionOptions('totallyrandomvalue', undefined, [ - Buffer.from('1234', 'ascii').toString('base64'), - Buffer.from('5678', 'ascii').toString('base64'), - ]); + const options = generateAssertionOptions({ + challenge: 'totallyrandomvalue', + allowedBase64CredentialIDs: [ + Buffer.from('1234', 'ascii').toString('base64'), + Buffer.from('5678', 'ascii').toString('base64'), + ], + }); - expect(options.publicKey.timeout).toEqual(60000); + expect(options.timeout).toEqual(60000); }); |