diff options
author | Pawel Zelawski <pawel.zelawski@outlook.com> | 2025-04-09 19:41:13 +0200 |
---|---|---|
committer | Pawel Zelawski <pawel.zelawski@outlook.com> | 2025-04-09 19:41:13 +0200 |
commit | abba6e3cd53e14fbec27ebd810ef0e67fc174e0b (patch) | |
tree | 266f3eb447fe087ca306724b331646847f3913e2 /examples/verify-callback-example.ts | |
parent | 81931d914b0edd6be21e4c03d33f64d71af99267 (diff) |
test: Add unit tests for core digiid logic
- Set up test file structure and configuration with Vitest.
- Add comprehensive unit tests for `generateDigiIDUri`, mocking `crypto.randomBytes` for predictable nonces.
- Refactor signature verification logic into `_internalVerifySignature` helper function to facilitate testing.
- Add unit tests for `verifyDigiIDCallback`, covering validation logic (URL, nonce, scheme checks).
- Utilize `vi.spyOn` to attempt mocking the outcome of `_internalVerifySignature`.
- Skip 6 tests related to signature verification outcomes due to difficulties reliably mocking the interaction with the underlying CJS 'digibyte-message' dependency in the testing environment. These scenarios will be covered by integration tests later.
- Confirmed remaining 19 unit tests pass, covering URI generation and callback validation logic.
Diffstat (limited to 'examples/verify-callback-example.ts')
0 files changed, 0 insertions, 0 deletions