Skip to content

Commit

Permalink
Re-add test
Browse files Browse the repository at this point in the history
  • Loading branch information
CountNick committed Jun 18, 2024
1 parent d692c13 commit 78f1d5b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/cookie-consent.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import CookieConsent from "../src/cookie-consent";

describe("CookieConsent", () => {
const FOO = { id: "foo", accepted: true };
const BAR = { id: "bar", accepted: false };
const COOKIES = [FOO, BAR];

window.customElements.define("cookie-consent", CookieConsent);

const cookieConsent = document.createElement("cookie-consent");

cookieConsent.cookies = COOKIES;

test("updatePreference", () => {
const input = [
{ id: "foo", accepted: false },
{ id: "bar", accepted: true },
];

cookieConsent.updatePreference(input);

expect(cookieConsent.preferences.getAll("foo")).toEqual(input);
});
});

0 comments on commit 78f1d5b

Please sign in to comment.