Skip to content

Commit

Permalink
test: fix unit test and pnpm-lock.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho112 committed Apr 15, 2024
1 parent 5b5dd0a commit fa6467d
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 71 deletions.
3 changes: 2 additions & 1 deletion packages/biometric-ed25519/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"fido2-lib": "3.4.1"
},
"devDependencies": {
"@types/node": "18.11.18"
"@types/node": "18.11.18",
"jest": "26.0.1"
}
}
16 changes: 8 additions & 8 deletions packages/biometric-ed25519/test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ describe('sanitizeCreateKeyResponse', () => {


const result = sanitizeCreateKeyResponse(mockCredential);
expect(result.rawId).toBeInstanceOf(ArrayBuffer);
expect(result.response.clientDataJSON).toBeInstanceOf(ArrayBuffer);
expect(result.response.attestationObject).toBeInstanceOf(ArrayBuffer);
expect(result.rawId.constructor.name).toBe('ArrayBuffer');
expect(result.response.clientDataJSON.constructor.name).toBe('ArrayBuffer');
expect(result.response.attestationObject.constructor.name).toBe('ArrayBuffer');
});

it('should return the input unchanged if not PublicKeyCredential or without Uint8Arrays', () => {
Expand Down Expand Up @@ -79,11 +79,11 @@ describe('sanitizeGetKeyResponse', () => {
});

const result = sanitizeGetKeyResponse(mockCredential);
expect(result.rawId).toBeInstanceOf(ArrayBuffer);
expect(result.response.authenticatorData).toBeInstanceOf(ArrayBuffer);
expect(result.response.clientDataJSON).toBeInstanceOf(ArrayBuffer);
expect(result.response.signature).toBeInstanceOf(ArrayBuffer);
expect(result.response.userHandle).toBeInstanceOf(ArrayBuffer);
expect(result.rawId.constructor.name).toBe('ArrayBuffer');
expect(result.response.clientDataJSON.constructor.name).toBe('ArrayBuffer');
expect(result.response.authenticatorData.constructor.name).toBe('ArrayBuffer');
expect(result.response.signature.constructor.name).toBe('ArrayBuffer');
expect(result.response.userHandle.constructor.name).toBe('ArrayBuffer');
});

it('should return the input unchanged if it does not meet conversion criteria', () => {
Expand Down
Loading

0 comments on commit fa6467d

Please sign in to comment.