summaryrefslogtreecommitdiff
path: root/src/__tests__
AgeCommit message (Collapse)Author
2025-04-09test: Add unit tests for core digiid logicPawel Zelawski
- 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.