{
  "id": 6949597,
  "title": "The test that failed every morning and passed every afternoon",
  "url": "https://urgent.news/2026/09/12/the-test-that-failed-every-morning-and-passed-every-afternoon",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-12T16:13:57.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/eugen_taranowski/the-test-that-failed-every-morning-and-passed-every-afternoon-35pa"
  },
  "original_language": "en",
  "account": "The test suite in a software application failed unexpectedly after a seemingly unrelated change was made. The failure occurred because a test case was counting the next episode airing as two days away instead of one, due to a mismatch between how dates were being measured in the test and the actual function. The test was designed to check the day arithmetic for an episode's air date, but it was using UTC time while the function calculated days based on the show's location in the United States. This discrepancy caused the test to fail intermittently during specific time windows when the UTC date rolled over to a new day while the Los Angeles time did not. The issue was traced to the test using the `toISOString()` method, which always formats dates in UTC, while the function used the `DateTime.now().setZone(zone)` method to calculate days based on the user's timezone. The fix involved adjusting the test to use the same timezone as the function, ensuring both measured days consistently. However, this fix also rendered the test unable to catch future issues related to the timezone mapping, as it now derived the timezone from the same table the code used. Despite this limitation, the fix successfully eliminated the intermittent failure, ensuring that the test accurately reflected the intended behavior of the day arithmetic function.",
  "summary": "Originally published on the WatchNext blog . While making an unrelated change — adding a processor to a privacy page and a link to a footer — the test suite came back with eleven passes and one failure: - 1 + 2 ❯ tests/airDate.test.ts:125:47 125| expect(getAirDateDaysDiff(plus(1), \"US\")).toBe(1); | ^ An episode airing tomorrow was being counted as two days away. That is about as load-bearing as a…",
  "key_points": [
    "Test suite failed due to date measurement mismatch",
    "UTC vs. U.S. timezone caused intermittent failures",
    "Fix aligned test and function timezones"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 2,
    "also_reported_by": [
      {
        "outlet": "Dev.to",
        "title": "56 fault-injection tests passed. The one that injected nothing failed.",
        "url": "https://urgent.news/2026/09/13/56-fault-injection-tests-passed-the-one-that-injected-nothing-failed",
        "published": "2026-09-13T04:05:27.000Z"
      }
    ]
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}