I have this unit test :
import { describe, expect, it } from "@jest/globals"
import { format2APIDate } from "../helpers"
describe("format2APIDate()", () => {
it("should return a date with the format: YYYY/MM/DD for date with this format YYYY-MM-DD", () => {
const date = new Date("2024-02-12")
const formattedDate = format2APIDate(date)
expect(formattedDate).toBe("2024/02/12")
})
it("should return a date with the format: YYYY/MM/DD when a date has this format", () => {
const date = new Date("Mon Feb 12 2024 00:00:00 GMT+0100 (Central European Standard Time)")
const formattedDate = format2APIDate(date)
expect(formattedDate).toBe("2024/02/12")
})
})
When I run the tests locally:
npm run test
.
They are passed.
However, when I merge the changes, the last test fails: