Odoo18-Base/addons/web/static/lib/hoot/tests/mock/network.test.js

33 lines
911 B
JavaScript
Raw Permalink Normal View History

2025-01-06 10:57:38 +07:00
/** @odoo-module */
import { describe, expect, test } from "@odoo/hoot";
import { mockFetch } from "@odoo/hoot-mock";
import { parseUrl } from "../local_helpers";
describe(parseUrl(import.meta.url), () => {
test("setup network values", async () => {
expect(document.cookie).toBe("");
document.cookie = "cids=4";
document.title = "kek";
expect(document.cookie).toBe("cids=4");
expect(document.title).toBe("kek");
});
test("values are reset between test", async () => {
expect(document.cookie).toBe("");
expect(document.title).toBe("");
});
test("fetch should not mock internal URLs", async () => {
mockFetch(expect.step);
await fetch("http://some.url");
await fetch("/odoo");
await fetch(URL.createObjectURL(new Blob([""])));
expect.verifySteps(["http://some.url", "/odoo"]);
});
});