diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /browser/components/newtab/test/unit/asrouter/PanelTestProvider.test.js | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/newtab/test/unit/asrouter/PanelTestProvider.test.js')
-rw-r--r-- | browser/components/newtab/test/unit/asrouter/PanelTestProvider.test.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/browser/components/newtab/test/unit/asrouter/PanelTestProvider.test.js b/browser/components/newtab/test/unit/asrouter/PanelTestProvider.test.js new file mode 100644 index 0000000000..1a15f705ee --- /dev/null +++ b/browser/components/newtab/test/unit/asrouter/PanelTestProvider.test.js @@ -0,0 +1,42 @@ +import { PanelTestProvider } from "lib/PanelTestProvider.jsm"; +import schema from "content-src/asrouter/schemas/panel/cfr-fxa-bookmark.schema.json"; +import update_schema from "content-src/asrouter/templates/OnboardingMessage/UpdateAction.schema.json"; +import whats_new_schema from "content-src/asrouter/templates/OnboardingMessage/WhatsNewMessage.schema.json"; + +describe("PanelTestProvider", () => { + let messages; + beforeEach(async () => { + messages = await PanelTestProvider.getMessages(); + }); + it("should have a message", () => { + // Careful: when changing this number make sure that new messages also go + // through schema verifications. + assert.lengthOf(messages, 13); + }); + it("should be a valid message", () => { + const fxaMessages = messages.filter( + ({ template }) => template === "fxa_bookmark_panel" + ); + for (let message of fxaMessages) { + assert.jsonSchema(message.content, schema); + } + }); + it("should be a valid message", () => { + const updateMessages = messages.filter( + ({ template }) => template === "update_action" + ); + for (let message of updateMessages) { + assert.jsonSchema(message.content, update_schema); + } + }); + it("should be a valid message", () => { + const whatsNewMessages = messages.filter( + ({ template }) => template === "whatsnew_panel_message" + ); + for (let message of whatsNewMessages) { + assert.jsonSchema(message.content, whats_new_schema); + // Not part of `message.content` so it can't be enforced through schema + assert.property(message, "order"); + } + }); +}); |