31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { describe, expect, test } from "vitest";
|
|
|
|
import manifest from "../src/manifest.json";
|
|
|
|
describe("manifest", () => {
|
|
test("injects the content script on the www Xingtu market page", () => {
|
|
expect(manifest.content_scripts?.[0]?.matches).toEqual(
|
|
expect.arrayContaining([
|
|
expect.stringMatching(/^https:\/\/(\*\.|www\.)?xingtu\.cn\/ad\/creator\/market\*$/)
|
|
])
|
|
);
|
|
expect(manifest.content_scripts?.[0]?.run_at).toBe("document_start");
|
|
});
|
|
|
|
test("declares the downloads and auth permissions plus background worker", () => {
|
|
expect(manifest.permissions).toEqual(
|
|
expect.arrayContaining(["downloads", "identity", "storage"])
|
|
);
|
|
expect(manifest.host_permissions).toEqual(
|
|
expect.arrayContaining([
|
|
"http://*/*",
|
|
"https://login-api.intelligrow.cn/*",
|
|
"http://127.0.0.1:4319/*",
|
|
"https://*/*"
|
|
])
|
|
);
|
|
expect(manifest.background?.service_worker).toBe("background/index.js");
|
|
expect(manifest.action?.default_popup).toBe("popup/index.html");
|
|
});
|
|
});
|