Summary of What Needs to be Done: Add unit tests for the leaderboard utility functions in src/lib/leaderboard.ts, covering validateUserConcurrency, exported constants, and any pure helper functions.
Changes that Need to be Made: Create test/leaderboard.test.ts with vitest. Cover: validateUserConcurrency returns DEFAULT (5) when env var is absent, returns clamped value when outside [1, 100] range, returns integer when valid, logs info when non-default, CACHE_REFRESH_SECONDS equals 3600, CACHE_STALE_SECONDS equals 21600, LEADERBOARD_CACHE_KEY is non-empty string, exported type constants are correct strings.
Impact that it would Provide: Leaderboard is a high-traffic feature. Testing the concurrency config and constants prevents misconfiguration that could cause rate limiting or performance degradation.
Hello @Priyanshu-byte-coder, please assign this issue to me (@tmdeveloper007) so I can open a focused PR.
Summary of What Needs to be Done: Add unit tests for the leaderboard utility functions in src/lib/leaderboard.ts, covering validateUserConcurrency, exported constants, and any pure helper functions.
Changes that Need to be Made: Create test/leaderboard.test.ts with vitest. Cover: validateUserConcurrency returns DEFAULT (5) when env var is absent, returns clamped value when outside [1, 100] range, returns integer when valid, logs info when non-default, CACHE_REFRESH_SECONDS equals 3600, CACHE_STALE_SECONDS equals 21600, LEADERBOARD_CACHE_KEY is non-empty string, exported type constants are correct strings.
Impact that it would Provide: Leaderboard is a high-traffic feature. Testing the concurrency config and constants prevents misconfiguration that could cause rate limiting or performance degradation.
Hello @Priyanshu-byte-coder, please assign this issue to me (@tmdeveloper007) so I can open a focused PR.