summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/methods
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2022-04-27 09:39:44 -0700
committerMatthew Miller <matthew@millerti.me>2022-04-27 09:39:44 -0700
commita40c03ec385a4cdf63a2c25a60b4ca726a30d301 (patch)
tree1e5942bbafe8f2000d89e87cb4022a19437b22c2 /packages/browser/src/methods
parentd66925d6f6b706d4c8f024481953f5e09f8e2b0f (diff)
Add tests for new transport
Diffstat (limited to 'packages/browser/src/methods')
-rw-r--r--packages/browser/src/methods/startAuthentication.test.ts17
-rw-r--r--packages/browser/src/methods/startRegistration.test.ts17
2 files changed, 34 insertions, 0 deletions
diff --git a/packages/browser/src/methods/startAuthentication.test.ts b/packages/browser/src/methods/startAuthentication.test.ts
index 725cd4e..658b67c 100644
--- a/packages/browser/src/methods/startAuthentication.test.ts
+++ b/packages/browser/src/methods/startAuthentication.test.ts
@@ -202,6 +202,23 @@ test('should include extension results when no extensions specified', async () =
expect(response.clientExtensionResults).toEqual({});
});
+test('should support "cable" transport', async () => {
+ const opts: PublicKeyCredentialRequestOptionsJSON = {
+ ...goodOpts1,
+ allowCredentials: [
+ {
+ ...goodOpts1.allowCredentials![0],
+ transports: ["cable"],
+ },
+ ]
+ };
+
+ await startAuthentication(opts);
+
+ expect(mockNavigatorGet.mock.calls[0][0].publicKey.allowCredentials[0].transports[0])
+ .toEqual("cable");
+});
+
describe('WebAuthnError', () => {
describe('AbortError', () => {
const AbortError = generateCustomError('AbortError');
diff --git a/packages/browser/src/methods/startRegistration.test.ts b/packages/browser/src/methods/startRegistration.test.ts
index 360884e..d8d34aa 100644
--- a/packages/browser/src/methods/startRegistration.test.ts
+++ b/packages/browser/src/methods/startRegistration.test.ts
@@ -176,6 +176,23 @@ test('should include extension results when no extensions specified', async () =
expect(response.clientExtensionResults).toEqual({});
});
+test('should support "cable" transport', async () => {
+ const opts: PublicKeyCredentialCreationOptionsJSON = {
+ ...goodOpts1,
+ excludeCredentials: [
+ {
+ ...goodOpts1.excludeCredentials![0],
+ transports: ["cable"],
+ },
+ ]
+ };
+
+ await startRegistration(opts);
+
+ expect(mockNavigatorCreate.mock.calls[0][0].publicKey.excludeCredentials[0].transports[0])
+ .toEqual("cable");
+});
+
describe('WebAuthnError', () => {
describe('AbortError', () => {
const AbortError = generateCustomError('AbortError');