Summary of What Needs to be Done: The repository has zero test files for core utility functions. The crypto.ts file contains encryptToken and decryptToken functions with complex logic that lacks test coverage. Adding unit tests will ensure the encryption/decryption works correctly and prevent regressions.
Changes that Need to be Made:
- Create new file: src/lib/crypto.test.ts
- Add tests for encryptToken:
- Should encrypt and decrypt a token successfully
- Should return different ciphertext for same input (due to random IV)
- Add tests for decryptToken:
- Should throw on invalid hex input (odd length)
- Should throw on invalid hex input (non-hex characters)
- Should throw on invalid IV length
Use Node's native node:test and node:assert/strict modules.
Impact that it would Provide:
- Ensures encrypt/decrypt functionality works correctly
- Catches regressions early in development
- Provides documentation of expected behavior
Summary of What Needs to be Done: The repository has zero test files for core utility functions. The crypto.ts file contains encryptToken and decryptToken functions with complex logic that lacks test coverage. Adding unit tests will ensure the encryption/decryption works correctly and prevent regressions.
Changes that Need to be Made:
Use Node's native node:test and node:assert/strict modules.
Impact that it would Provide: