Skip to content

test : add unit tests for cacheGet and cacheSet functions #694

@tmdeveloper007

Description

@tmdeveloper007

Summary of What Needs to be Done:
Add unit tests for the cacheGet and cacheSet functions in src/lib/metrics-cache.ts. Tests must use vitest framework and import actual source code.

Changes that Need to be Made:

  • Create test using vitest describe/it/expect
  • Import cacheGet and cacheSet from src/lib/metrics-cache.ts
  • Test cacheGet returns null when redis unavailable
  • Test cacheSet validates TTL values
  • Test round-trip when cache available

Impact that it would Provide:

  • Ensures cache handles failure gracefully
  • Validates TTL input validation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions