import { getLocalVue } from "@tests/vitest/helpers"; import { shallowMount } from "@vue/test-utils"; import { describe, expect, it } from "vitest"; import ConfigurationMarkdown from "./ConfigurationMarkdown.vue"; const localVue = getLocalVue(); describe("ConfigurationMarkdown.vue", () => { let wrapper; it("should convert supplied configuration markup to markdown and display", () => { wrapper = shallowMount(ConfigurationMarkdown as object, { propsData: { markdown: "the *content*", admin: true }, localVue, }); expect(wrapper.html()).toContain("content"); }); it("should allow HTML in configuration markup explicitly set by the admin", () => { wrapper = shallowMount(ConfigurationMarkdown as object, { propsData: { markdown: "the content", admin: true }, localVue, }); expect(wrapper.html()).toContain("content"); }); it("should escape supplied HTML for non-admin sourced content", () => { wrapper = shallowMount(ConfigurationMarkdown as object, { propsData: { markdown: "the content", admin: false }, localVue, }); expect(wrapper.html()).not.toContain("content"); }); });