mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-12 22:28:59 +02:00
# ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D36042 --HG-- extra : source : d3afcafdce650a6f36cebbc126ee93b17f13cf52
41 lines
1.6 KiB
JavaScript
41 lines
1.6 KiB
JavaScript
import EOYSnippetSchema from "../../../content-src/asrouter/templates/EOYSnippet/EOYSnippet.schema.json";
|
|
import SimpleBelowSearchSnippetSchema from "../../../content-src/asrouter/templates/SimpleBelowSearchSnippet/SimpleBelowSearchSnippet.schema.json";
|
|
import SimpleSnippetSchema from "../../../content-src/asrouter/templates/SimpleSnippet/SimpleSnippet.schema.json";
|
|
import { SnippetsTestMessageProvider } from "../../../lib/SnippetsTestMessageProvider.jsm";
|
|
import SubmitFormSnippetSchema from "../../../content-src/asrouter/templates/SubmitFormSnippet/SubmitFormSnippet.schema.json";
|
|
|
|
const schemas = {
|
|
simple_snippet: SimpleSnippetSchema,
|
|
newsletter_snippet: SubmitFormSnippetSchema,
|
|
fxa_signup_snippet: SubmitFormSnippetSchema,
|
|
send_to_device_snippet: SubmitFormSnippetSchema,
|
|
eoy_snippet: EOYSnippetSchema,
|
|
simple_below_search_snippet: SimpleBelowSearchSnippetSchema,
|
|
};
|
|
|
|
describe("SnippetsTestMessageProvider", () => {
|
|
let messages = SnippetsTestMessageProvider.getMessages();
|
|
|
|
it("should return an array of messages", () => {
|
|
assert.isArray(messages);
|
|
});
|
|
|
|
it("should have a valid example of each schema", () => {
|
|
Object.keys(schemas).forEach(templateName => {
|
|
const example = messages.find(
|
|
message => message.template === templateName
|
|
);
|
|
assert.ok(example, `has a ${templateName} example`);
|
|
});
|
|
});
|
|
|
|
it("should have examples that are valid", () => {
|
|
messages.forEach(example => {
|
|
assert.jsonSchema(
|
|
example.content,
|
|
schemas[example.template],
|
|
`${example.id} should be valid`
|
|
);
|
|
});
|
|
});
|
|
});
|