airqo-platform / airqo-platform/AirQo-api

Add test coverage for validateDateRange function

Đang mở
#4,516 0 bình luận 0 reaction 1 người được giao Được @Baalmart nhận Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
26
Fork
24
Merge trung bình
5 giờ 36 phút
Pull request đã merge (30 ngày)
81

Mô tả

## Description

The newly implemented `validateDateRange` function in `src/device-registry/validators/activities.validators.js` lacks test coverage. This function is critical as it validates that activity dates are not in the future and not more than one month in the past.

## Requirements

Please add unit tests that verify:
- A date in the future correctly triggers an error.
- A date more than one month in the past correctly triggers an error.
- A valid date within the acceptable range returns `true`.

## Context
- Referenced in PR: #4515
- Comment URL: https://github.com/airqo-platform/AirQo-api/pull/4515#discussion_r1977414281

## Importance
Adding these tests will help ensure robust edge-case handling and maintain code quality as the application evolves.

## Acceptance Criteria
- [ ] Unit tests created for the `validateDateRange` function
- [ ] All test cases passing
- [ ] Code coverage for the function reaches 100%

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.