Skip to content

Commit

Permalink
Fix TZ suffix expectation
Browse files Browse the repository at this point in the history
  • Loading branch information
nonword committed Dec 20, 2023
1 parent 0bb75b6 commit d0235cd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/utils/utilsTests/pickupTimeEstimator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,12 @@ describe("pickupTimeEstimator", () => {
mockNowTimestamp = "2023-06-01T12:00:00-04:00"
jest.spyOn(estimator, "now").mockImplementation(() => mockNowTimestamp)

// Insist on NY time, unless run with another TZ
process.env.TZ = process.env.TZ || "America/New_York"

// When running tests with TZ set to anything other than ET, let"s expect
// all statements about time of day to end in "ET":
tzNote =
process.env.TZ && process.env.TZ !== "America/New_York" ? " ET" : ""
// When tests are run in an environment where the system timezone
// (configured via TZ or another means) results in a TZ offset other
// than NY, expect estimation strings to be suffixed with " ET":
const expectTzNote =
estimator.nyOffset() !== new Date(estimator.now()).getTimezoneOffset() / 60
tzNote = expectTzNote ? " ET": ""
})

describe("findNextAvailableHours", () => {
Expand Down

0 comments on commit d0235cd

Please sign in to comment.