/* global global, jest */ import Cookies from "js-cookie"; import ConsentManager from "src/decidim/data_consent/consent_manager"; // Mock js-cookie so that we can store the return values from the "set" method // in order to inspect their flags. jest.mock("js-cookie", () => { const originalModule = jest.requireActual("js-cookie"); return { // ...originalModule, cookieStorage: {}, get: originalModule.get, set: function (name, value, options) { this.cookieStorage[name] = originalModule.set(name, value, options); } }; }); Reflect.deleteProperty(global.window, "location"); global.window = Object.create(window); global.window.location = { protocol: "https:", hostname: "decidim.dev" }; describe("ConsentManager", () => { const dialogContent = `
You need to enable all cookies in order to see this content.
Change cookie settings