test : added unit tests for getRedisClient lazy initialization#796
test : added unit tests for getRedisClient lazy initialization#796tmdeveloper007 wants to merge 2 commits into
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):
|
bb799c3 to
6d37816
Compare
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
Import pattern is correct — function imported from source. Three infrastructure issues to fix before merge:
- Missing
"test": "vitest run"inpackage.jsonscripts — tests can't run in CI without this. vitest.config.tsmissingresolve.alias—@/lib/*path aliases fail without:
import path from 'path'
export default defineConfig({
resolve: { alias: { '@': path.resolve(__dirname, 'src') } },
test: { globals: true }
})- Missing EOF newline on test file.
ffb3e22 to
cf3ebb1
Compare
Closes Priyanshu-byte-coder#776 Added test/getRedisClient.test.ts covering: - Returns null when UPSTASH_REDIS_REST_URL is not set - Returns null when UPSTASH_REDIS_REST_TOKEN is not set - Returns Redis instance when both env vars are set - Returns same singleton instance on repeated calls (cache behavior) Impact: All 4 tests pass. Redis client lazy initialization validated.
…test for type checking
|
This pull request is fully up-to-date with the latest upstream merges, all review items are addressed, local tests are passing cleanly, and it is fully ready to be merged! 🚀 |
Closes #776.
Summary of What Has Been Done:
Added test/getRedisClient.test.ts with 4 vitest tests covering the getRedisClient lazy initialization from src/lib/metrics-cache.ts.
Changes Made:
New file: test/getRedisClient.test.ts
Test coverage:
Impact it Made:
All 4 tests pass. Redis client initialization validated.