test(date-range): pin system date to avoid month-boundary failures#1246
Merged
danimuller20 merged 41 commits intomasterfrom Apr 30, 2026
Merged
test(date-range): pin system date to avoid month-boundary failures#1246danimuller20 merged 41 commits intomasterfrom
danimuller20 merged 41 commits intomasterfrom
Conversation
Day arithmetic in DateRange tests assumed TODAY ± 1 stayed within the same calendar month, which broke on the 30/31 of any month. Pin `new Date()` (no-args) to a fixed mid-month date and make the disabled days helper lazy so it picks up the pinned date at use time. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Addresses SonarCloud typescript:S7764 issues on the pinned-Date setup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The project's eslint env does not expose globalThis, so the previous commit broke the lint step. Declare it explicitly via /* global */. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
lpeil
approved these changes
Apr 30, 2026
leonardodouradol
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
DateRangeassumia queTODAY ± 1ficava no mesmo mês, quebrando nos dias 30/31 (falha reproduzida em 30/04/2026 —TOMORROW=31não existia em abril).new Date()(sem args) é fixado em uma data fixa de meio de mês (15/06/2025) para queTODAY/YESTERDAY/TOMORROWsempre caiam no mesmo mês visível do calendário.Date.now()e timers seguem reais para não afetarwaitFornem o teste de tooltip por timeout.commonDisabledDaysProps.disabledDaysvirou getter para avaliarnew Date()no momento do uso (e respeitar a data fixada), em vez de capturar no import.Test plan
npx jest packages/ocean-react/src/Date/__tests__/DateRange.test.tsx— 24/24 passamnpm test— 62 suites, 699 testes, todos passam🤖 Generated with Claude Code