Skip to content

Commit

Permalink
Add default TZ to test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
nonword committed Dec 20, 2023
1 parent b7a0b13 commit 0bb75b6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/utils/utilsTests/pickupTimeEstimator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ 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 =
Expand Down Expand Up @@ -284,9 +287,9 @@ describe("pickupTimeEstimator", () => {
})

it("should return the given time if it falls within the next destination service time", async () => {
expect(await estimator.getServiceTime("sc", "2023-06-01T12:00:00-04:00")).toBe(
"2023-06-01T12:00:00-04:00"
)
expect(
await estimator.getServiceTime("sc", "2023-06-01T12:00:00-04:00")
).toBe("2023-06-01T12:00:00-04:00")
})

it("should return the start of the next service time if given time falls outside of service hours", async () => {
Expand Down

0 comments on commit 0bb75b6

Please sign in to comment.