summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/methods/startRegistration.test.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2023-06-25 11:01:53 -0700
committerMatthew Miller <matthew@millerti.me>2023-06-25 11:01:53 -0700
commit5787bb38d60bda3bcada741353016ca328f116f0 (patch)
tree94d9ca6b225b00f7f9d507fc0d10bdb4da156f57 /packages/browser/src/methods/startRegistration.test.ts
parent84ce69c1f545bf6345a08ead634ecf15d578d2a7 (diff)
Add test for absence of getters
Diffstat (limited to 'packages/browser/src/methods/startRegistration.test.ts')
-rw-r--r--packages/browser/src/methods/startRegistration.test.ts25
1 files changed, 24 insertions, 1 deletions
diff --git a/packages/browser/src/methods/startRegistration.test.ts b/packages/browser/src/methods/startRegistration.test.ts
index f8c0e5a..e27099d 100644
--- a/packages/browser/src/methods/startRegistration.test.ts
+++ b/packages/browser/src/methods/startRegistration.test.ts
@@ -250,7 +250,7 @@ test('should return authenticatorAttachment if present', async () => {
expect(response.authenticatorAttachment).toEqual('cross-platform');
});
-test('should return convenience values if present', async () => {
+test('should return convenience values if getters present', async () => {
/**
* I call them "convenience values" because the getters for public key algorithm,
* public key bytes, and authenticator data are alternative ways to access information
@@ -277,6 +277,29 @@ test('should return convenience values if present', async () => {
expect(response.response.authenticatorData).toEqual('AAAAAA');
});
+test('should not return convenience values if getters missing', async () => {
+ /**
+ * I call them "convenience values" because the getters for public key algorithm,
+ * public key bytes, and authenticator data are alternative ways to access information
+ * that's already buried in the response.
+ */
+ // Mock extension return values from authenticator
+ mockNavigatorCreate.mockImplementation((): Promise<any> => {
+ return new Promise(resolve => {
+ resolve({
+ response: {},
+ getClientExtensionResults: () => { },
+ });
+ });
+ });
+
+ const response = await startRegistration(goodOpts1);
+
+ expect(response.response.publicKeyAlgorithm).toBeUndefined();
+ expect(response.response.publicKey).toBeUndefined();
+ expect(response.response.authenticatorData).toBeUndefined();
+});
+
describe('WebAuthnError', () => {
describe('AbortError', () => {
const AbortError = generateCustomError('AbortError');