From 4214de2dede75bfc54247efd5338665046f75723 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Wed, 7 Jun 2023 09:50:13 -0400 Subject: [PATCH] CSR-1421: fixes to unit tests once router-link was moved into textBlock --- src/digital-components/text-block/text-block.spec.js | 2 +- src/helpers/cms-content-helper.js | 4 ++-- src/ux-components/alert/alert.spec.js | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/digital-components/text-block/text-block.spec.js b/src/digital-components/text-block/text-block.spec.js index 89b2fdf36..c9825f36f 100644 --- a/src/digital-components/text-block/text-block.spec.js +++ b/src/digital-components/text-block/text-block.spec.js @@ -1,7 +1,7 @@ import { shallowMount } from "@vue/test-utils"; import TextBlock from "./text-block"; -describe("modal.vue", () => { +describe("text-block.vue", () => { it("Should display 'Text' when 'Text' is defined in the CMS", async () => { // Act const wrapper = shallowMount(TextBlock, { diff --git a/src/helpers/cms-content-helper.js b/src/helpers/cms-content-helper.js index b4927894f..f4ae0be6d 100644 --- a/src/helpers/cms-content-helper.js +++ b/src/helpers/cms-content-helper.js @@ -1,6 +1,6 @@ import { storeActions } from "@/constants/store-actions.js"; import store from "@/store"; -import { dynamicStrings } from "../constants/dynamic-strings"; +import { dynamicStrings } from "@/constants/dynamic-strings"; export function fetchCmsContentForPage(fmgPage) { return store.dispatch(storeActions.GET_PAGE_DATA, { pageName: fmgPage }).then((response) => { @@ -284,7 +284,7 @@ function getIfStatementRegexExpression() { ////////////////////////////////////////// export function doesCopyContainRouterLink(copy) { - return copy.includes(this.dynamicStrings.ROUTER_LINK); + return copy.includes(dynamicStrings.ROUTER_LINK); } export function doesCopyContainTextLink(copy) { diff --git a/src/ux-components/alert/alert.spec.js b/src/ux-components/alert/alert.spec.js index 1f5d0fcc8..9d8112189 100644 --- a/src/ux-components/alert/alert.spec.js +++ b/src/ux-components/alert/alert.spec.js @@ -15,7 +15,6 @@ describe("alert.vue", () => { }, }) ); - const wrapperDiv = wrapper.find("div"); // Assert @@ -49,7 +48,7 @@ describe("alert.vue", () => { expect(wrapper.vm.alertCopy).toBe("testCopy"); }); - it("Should container a tag if the manualCopy contains a {routerLink: testName, testLink} placeholder", () => { + it("Should container a tag if the manualCopy contains a {routerLink: testName, testLink} placeholder", () => { // Arrange & Act const wrapper = shallowMount( alert, @@ -58,11 +57,12 @@ describe("alert.vue", () => { manualHeadline: "testHeader", manualCopy: "testCopy with a {routerLink: testName, testLink} inside of it", }, - stubs: ["router-link"], + stubs: ["textBlock"], }) ); + // Assert - expect(wrapper.find("router-link").exists()).toBe(true); + expect(wrapper.html()).toEqual(expect.stringContaining("text-block-stub")); }); it("Should contain 'n+1'

tags if the body copy has 'n'

tags", () => {