test : added unit tests for dateUtils.ts functions#784
Open
tmdeveloper007 wants to merge 3 commits into
Open
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):
|
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.
Priyanshu-byte-coder
requested changes
May 23, 2026
Owner
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.
7825f43 to
488132a
Compare
…test for type checking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #764.
Summary of What Has Been Done:
Added test/dateUtils.test.ts with comprehensive vitest unit tests covering all exported functions in src/lib/dateUtils.ts.
Changes Made:
New file: test/dateUtils.test.ts
Test coverage (10 tests):
Uses vi.useFakeTimers() and vi.setSystemTime() for deterministic time-dependent testing.
Impact it Made:
All 10 tests pass. Week-boundary calculations are now validated across month transitions.