Skip to content

Commit

Permalink
add mock date to unit tests since we're now checking for that
Browse files Browse the repository at this point in the history
  • Loading branch information
gilluminate committed Jun 13, 2024
1 parent a37f0ad commit 8b4bd14
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions clients/fides-js/__tests__/lib/cookie.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ describe("getOrMakeFidesCookie", () => {
});

describe("saveFidesCookie", () => {
beforeEach(() =>
mockGetCookie.mockReturnValue(
JSON.stringify({ fides_meta: { updatedAt: MOCK_DATE } })
)
);
afterEach(() => mockSetCookie.mockClear());

it("updates the updatedAt date", () => {
Expand Down Expand Up @@ -288,25 +293,6 @@ describe("saveFidesCookie", () => {
);
}
);

// DEFER: known issue https://github.com/ethyca/fides/issues/2072
// eslint-disable-next-line jest/no-disabled-tests
it.skip.each([
{
url: "https://privacy.subdomain.example.co.uk",
expected: "example.co.uk",
},
])("it handles second-level domains ($url)", ({ url, expected }) => {
const mockUrl = new URL(url);
Object.defineProperty(window, "location", {
value: mockUrl,
writable: true,
});
const cookie: FidesCookie = getOrMakeFidesCookie();
saveFidesCookie(cookie);
expect(mockSetCookie.mock.calls).toHaveLength(1);
expect(mockSetCookie.mock.calls[0][2]).toHaveProperty("domain", expected);
});
});

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

0 comments on commit 8b4bd14

Please sign in to comment.