Real-Dev-Squad / website-status

Shows a roadmap of the ongoing projects being done
https://status.realdevsquad.com/
MIT License
21 stars 145 forks source link

Utils test/calendar #1108

Closed tejaskh3 closed 3 months ago

tejaskh3 commented 3 months ago

Date: 06/02/2024 Developer Name: Tejas


Issue Ticket Number #1097

List of PR(s) going in sync

1105

Description

This PR consist of test cases written for three utils funtion of calendar that is getStartOfDay, getDatesInRange, processData.

Documentation Updated?

Under Feature Flag

Database Changes

Breaking Changes

Development Tested?

Screenshots

NA

Test Coverage

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
userStatusCalendar.ts 63.33 80 57.14 62.06 31, 52-69

image

Test Suite Summary

getDatesInRange Tests

  1. Date Range: Verifies if the function generates an array of Unix timestamps for each day within a given date range.
  2. Single Day Range: Checks if the function handles a single-day range, resulting in one element in the array.
  3. One Day Range: Ensures the function works for a day with a one-day range, having two Unix timestamps in the array.
  4. Middle of the Time: Validates the function's behavior for dates with middle-of-the-time, including edge dates.
  5. Invalid Range: Checks if the function handles an invalid date range, returning an empty array.

processData Tests

  1. Null itemId: Tests if the function returns empty objects for a null itemId.
  2. No Matching Log: Ensures the function returns empty objects when there is no matching log for the provided itemId.
  3. Log with No Data: Validates the function's behavior when the log has no data.

image

Additional Notes

vercel[bot] commented 3 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
status-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 6, 2024 5:34pm