Repository navigation
Commit 2da04b8
authored
Fix TestFormatDueDate year-boundary flake (#514)
* Fix TestFormatDueDate year-boundary flake
The same-year assertion used now.AddDate(0, 6, 0), which crosses into the
next calendar year for any run after June — so from July onward the date
carried a year and the 'should not contain year' assertion failed.
Pick a date in the opposite half of the current year instead, keeping it
same-year and clear of the today/tomorrow/yesterday window regardless of
when in the year the suite runs.
* Make TestFormatDueDate fully deterministic
Address review: the test still read time.Now() while formatDueDate computed
its own time.Now() internally, leaving a residual midnight/New-Year race
where the two calls could observe different years.
Extract formatDueDateAt(iso, now) as a testable seam (formatDueDate stays a
thin wrapper passing time.Now()), and drive the test from a fixed reference
now so none of the relative-label cases depend on the wall clock.1 parent f4bf171 commit 2da04b8
2 files changed
Lines changed: 28 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1549 | 1549 | | |
1550 | 1550 | | |
1551 | 1551 | | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
1552 | 1559 | | |
1553 | 1560 | | |
1554 | 1561 | | |
1555 | 1562 | | |
1556 | | - | |
1557 | 1563 | | |
1558 | 1564 | | |
1559 | 1565 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
800 | 800 | | |
801 | 801 | | |
802 | 802 | | |
803 | | - | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
804 | 809 | | |
805 | 810 | | |
806 | 811 | | |
807 | 812 | | |
808 | | - | |
809 | | - | |
810 | | - | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
811 | 816 | | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
818 | 823 | | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
823 | 828 | | |
824 | | - | |
825 | | - | |
| 829 | + | |
| 830 | + | |
826 | 831 | | |
827 | 832 | | |
828 | 833 | | |
| |||
0 commit comments