test : add unit tests for resolveAppUser function#846
Conversation
|
@TESTPERSONAL is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel. A member of the Team first needs to authorize it. |
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
Tests must import from source — not reimplement the function locally.
The test file re-implements the function being tested inside the test itself. This defeats the purpose of testing — changes to the real implementation won't fail these tests.
Fix: import the actual function from its source file and test that import. Example:
import { safeCompare } from '../src/lib/crypto'
// then test safeCompare directlyAlso fix:
- Add
"test": "vitest run"toscriptsinpackage.json - Add
vitest.config.tswithresolve.alias: { '@': path.resolve(__dirname, 'src') } - Add EOF newline to test file
bcb967d to
b012687
Compare
|
Deployment failed with the following error: |
Closes #823.
Summary of What Has Been Done:
Added test/resolve-user.test.ts with vitest tests covering the resolveAppUser function from src/lib/resolve-user.ts.
Changes Made:
New file: test/resolve-user.test.ts
Test coverage:
Impact it Made:
Prevents regressions in user resolution logic. Validates upsert behavior for new vs existing users.