Skip to content

feat(test): add coverage for negative duration formatter inputs #2143

@Thacker-Meet

Description

@Thacker-Meet

Is your feature request related to a problem? Please describe.

The current time utility tests focus on expected duration values but do not explicitly verify behavior when negative duration inputs are provided.

In edge cases, malformed calculations, API responses, or unexpected arithmetic operations may generate negative duration values. Without dedicated test coverage, formatter output could become inconsistent or regress in future updates.

Describe the solution you'd like

Add a dedicated test case in utils/time.test.ts that verifies formatter behavior when negative duration values are passed.

Proposed implementation

  • Add a new test covering negative duration inputs.
  • Verify formatter output remains predictable.
  • Ensure existing positive-duration behavior remains unchanged.
  • Add assertions documenting the expected behavior.

Definition of done

  • 1 new test covering negative duration values.
  • Existing tests continue to pass.
  • Formatter behavior is verified through assertions.

Describe alternatives you've considered

An alternative would be to silently sanitize negative values before formatting.

However, adding test coverage first helps document and verify the current behavior without introducing implementation changes or affecting existing formatter logic.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions