Skip to content

Commit

Permalink
AppTP: Flaky whenLocalDateNowThenReturnWeeklyCohort test (#5426)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/1200905986587319/1209058892339948/f

### Description
Fixed flaky test.
`whenLocalDateNowThenReturnWeeklyCohort` should assert on week based
year and not the year directly as this makes the expected value to be
incorrect in edge-cases where the date is a date in a year and falls
into a previous year week. I.e 2025-01-01.

### Steps to test this PR

Note: PR Unit tests should pass as it was submitted the same day that
caused the failure (2024-01-30).

- [x] change `whenLocalDateNowThenReturnWeeklyCohort` date to be
`LocalDate.of(2024, 1, 30)`
- [x] verify test passes

### NO UI changes
  • Loading branch information
anikiki authored Jan 6, 2025
1 parent 01076f6 commit 11dcf5b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class RealCohortCalculatorTest {
@Test
fun whenLocalDateNowThenReturnWeeklyCohort() {
val date = LocalDate.now()
val year = date.year
val year = date.get(IsoFields.WEEK_BASED_YEAR)
assertEquals("$year-week-${date.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR)}", cohortCalculator.calculateCohortForDate(date))
}

Expand Down

0 comments on commit 11dcf5b

Please sign in to comment.