CSR-1421: fixes to unit tests once router-link was moved into textBlock

This commit is contained in:
Adam Caouette 2023-06-07 09:50:13 -04:00
parent f0c7ecbb9b
commit 4214de2ded
3 changed files with 7 additions and 7 deletions

View file

@ -1,7 +1,7 @@
import { shallowMount } from "@vue/test-utils"; import { shallowMount } from "@vue/test-utils";
import TextBlock from "./text-block"; import TextBlock from "./text-block";
describe("modal.vue", () => { describe("text-block.vue", () => {
it("Should display 'Text' when 'Text' is defined in the CMS", async () => { it("Should display 'Text' when 'Text' is defined in the CMS", async () => {
// Act // Act
const wrapper = shallowMount(TextBlock, { const wrapper = shallowMount(TextBlock, {

View file

@ -1,6 +1,6 @@
import { storeActions } from "@/constants/store-actions.js"; import { storeActions } from "@/constants/store-actions.js";
import store from "@/store"; import store from "@/store";
import { dynamicStrings } from "../constants/dynamic-strings"; import { dynamicStrings } from "@/constants/dynamic-strings";
export function fetchCmsContentForPage(fmgPage) { export function fetchCmsContentForPage(fmgPage) {
return store.dispatch(storeActions.GET_PAGE_DATA, { pageName: fmgPage }).then((response) => { return store.dispatch(storeActions.GET_PAGE_DATA, { pageName: fmgPage }).then((response) => {
@ -284,7 +284,7 @@ function getIfStatementRegexExpression() {
////////////////////////////////////////// //////////////////////////////////////////
export function doesCopyContainRouterLink(copy) { export function doesCopyContainRouterLink(copy) {
return copy.includes(this.dynamicStrings.ROUTER_LINK); return copy.includes(dynamicStrings.ROUTER_LINK);
} }
export function doesCopyContainTextLink(copy) { export function doesCopyContainTextLink(copy) {

View file

@ -15,7 +15,6 @@ describe("alert.vue", () => {
}, },
}) })
); );
const wrapperDiv = wrapper.find("div"); const wrapperDiv = wrapper.find("div");
// Assert // Assert
@ -49,7 +48,7 @@ describe("alert.vue", () => {
expect(wrapper.vm.alertCopy).toBe("testCopy"); expect(wrapper.vm.alertCopy).toBe("testCopy");
}); });
it("Should container a <router-link> tag if the manualCopy contains a {routerLink: testName, testLink} placeholder", () => { it("Should container a <textBlock> tag if the manualCopy contains a {routerLink: testName, testLink} placeholder", () => {
// Arrange & Act // Arrange & Act
const wrapper = shallowMount( const wrapper = shallowMount(
alert, alert,
@ -58,11 +57,12 @@ describe("alert.vue", () => {
manualHeadline: "testHeader", manualHeadline: "testHeader",
manualCopy: "testCopy with a {routerLink: testName, testLink} inside of it", manualCopy: "testCopy with a {routerLink: testName, testLink} inside of it",
}, },
stubs: ["router-link"], stubs: ["textBlock"],
}) })
); );
// Assert // Assert
expect(wrapper.find("router-link").exists()).toBe(true); expect(wrapper.html()).toEqual(expect.stringContaining("text-block-stub"));
}); });
it("Should contain 'n+1' <p> tags if the body copy has 'n' <p> tags", () => { it("Should contain 'n+1' <p> tags if the body copy has 'n' <p> tags", () => {