The list page now parses the calendar feed and renders each upcoming event (title, date, place) in chronological order, with a button that hands the event over to the town hall form. Sorting, date formatting and the café fallback live in a pure presentation module rather than in liste.js, which touches the DOM and cannot be imported under bun test. The seam to the sibling task's content script lives in transfert.js: a single storage slot, since a content script running on the town hall site has no way to learn a uid. The deposit is awaited before opening the tab, otherwise the content script could read before the write lands. Test timezone is pinned to Europe/Paris: date formatting is the core logic here and would otherwise pass only on machines set to Paris. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { existsSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
|
|
const extensionDir = join(import.meta.dir, "extension");
|
|
const manifest = await Bun.file(join(extensionDir, "manifest.json")).json();
|
|
|
|
describe("manifest.json", () => {
|
|
test("est en Manifest V3", () => {
|
|
expect(manifest.manifest_version).toBe(3);
|
|
});
|
|
|
|
test("déclare background.js comme script d'arrière-plan", () => {
|
|
expect(manifest.background.scripts).toContain("background.js");
|
|
});
|
|
|
|
test("demande les host_permissions des deux sources", () => {
|
|
expect(manifest.host_permissions).toEqual([
|
|
"https://atelier-huit.frama.space/*",
|
|
"https://www.ville-cugnaux.fr/*",
|
|
]);
|
|
});
|
|
|
|
test("demande la permission storage (couture liste → formulaire)", () => {
|
|
expect(manifest.permissions).toContain("storage");
|
|
});
|
|
|
|
test("ne définit PAS default_popup (sinon onClicked devient muet)", () => {
|
|
expect(manifest.action.default_popup).toBeUndefined();
|
|
});
|
|
|
|
test("porte un identifiant gecko", () => {
|
|
expect(manifest.browser_specific_settings.gecko.id).toBeDefined();
|
|
});
|
|
});
|
|
|
|
describe("ressources référencées", () => {
|
|
test("background.js existe", () => {
|
|
expect(existsSync(join(extensionDir, "background.js"))).toBe(true);
|
|
});
|
|
|
|
test("liste.html existe", () => {
|
|
expect(existsSync(join(extensionDir, "liste.html"))).toBe(true);
|
|
});
|
|
|
|
test("l'icône référencée existe", () => {
|
|
expect(existsSync(join(extensionDir, manifest.action.default_icon))).toBe(true);
|
|
});
|
|
});
|