summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/methods/startAssertion.test.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2021-02-03 15:35:46 -0800
committerMatthew Miller <matthew@millerti.me>2021-02-03 15:35:46 -0800
commit8b5bcf25d4cb987dbad430b5b629b05b56108d95 (patch)
tree9b7a20fa8a6546765409584e8460f22a9267a755 /packages/browser/src/methods/startAssertion.test.ts
parent1b6c2832ca5e1fbcc5a1f5e5c0acf257c81599f3 (diff)
Fix Browser unit tests
Diffstat (limited to 'packages/browser/src/methods/startAssertion.test.ts')
-rw-r--r--packages/browser/src/methods/startAssertion.test.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/packages/browser/src/methods/startAssertion.test.ts b/packages/browser/src/methods/startAssertion.test.ts
index c74b88f..f763391 100644
--- a/packages/browser/src/methods/startAssertion.test.ts
+++ b/packages/browser/src/methods/startAssertion.test.ts
@@ -4,7 +4,6 @@ import {
} from '@simplewebauthn/typescript-types';
import supportsWebauthn from '../helpers/supportsWebauthn';
-import toUint8Array from '../helpers/toUint8Array';
import bufferToBase64URLString from '../helpers/bufferToBase64URLString';
import startAssertion from './startAssertion';
@@ -21,7 +20,7 @@ const mockUserHandle = 'mockUserHandle';
// With ASCII challenge
const goodOpts1: PublicKeyCredentialRequestOptionsJSON = {
- challenge: bufferToBase64URLString(toUint8Array('fizz')),
+ challenge: bufferToBase64URLString(Buffer.from('fizz', 'ascii')),
allowCredentials: [
{
id: 'C0VGlvYFratUdAV1iCw-ULpUW8E-exHPXQChBfyVeJZCMfjMFcwDmOFgoMUz39LoMtCJUBW8WPlLkGT6q8qTCg',
@@ -34,7 +33,7 @@ const goodOpts1: PublicKeyCredentialRequestOptionsJSON = {
// With UTF-8 challenge
const goodOpts2UTF8: PublicKeyCredentialRequestOptionsJSON = {
- challenge: bufferToBase64URLString(toUint8Array('やれやれだぜ')),
+ challenge: bufferToBase64URLString(Buffer.from('やれやれだぜ', 'utf-8')),
allowCredentials: [],
timeout: 1,
};
@@ -88,7 +87,7 @@ test('should support optional allowCredential', async () => {
);
await startAssertion({
- challenge: bufferToBase64URLString(toUint8Array('fizz')),
+ challenge: bufferToBase64URLString(Buffer.from('fizz', 'ascii')),
timeout: 1,
});
@@ -111,7 +110,7 @@ test('should convert allow allowCredential to undefined when empty', async () =>
);
await startAssertion({
- challenge: bufferToBase64URLString(toUint8Array('fizz')),
+ challenge: bufferToBase64URLString(Buffer.from('fizz', 'ascii')),
timeout: 1,
allowCredentials: [],
});