From 18a3641a5402c45b8af8cb39ccdef3169ebc73dc Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Fri, 11 Feb 2022 17:02:17 -0500 Subject: [PATCH] CSR-254: remove invalid tests / add tests to increase code coverage --- .../funnel-footer/funnel-footer.spec.js | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/common-components/funnel-footer/funnel-footer.spec.js b/src/common-components/funnel-footer/funnel-footer.spec.js index 1c173b6be..6b2bd8335 100644 --- a/src/common-components/funnel-footer/funnel-footer.spec.js +++ b/src/common-components/funnel-footer/funnel-footer.spec.js @@ -5,7 +5,6 @@ describe("funnel-footer.vue", () => { it("Should return footer-link class", async () => { // Act - const r = { test:"testing", clientHeight: 10, @@ -18,43 +17,38 @@ describe("funnel-footer.vue", () => { const wrapper = mount(funnelFooter, { }); + wrapper.vm.initializeComponent(cmsContent); // Assert const link = wrapper.find("a"); - console.log(wrapper.html()); // Expect expect(link.attributes('class')).toContain("footer"); }); - it("Should return link text", async () => { + it("Should emit ForwardClicked on button click", async () => { // Act const wrapper = mount(funnelFooter, { - propsData: { - text: "Terms of use", - }, }); - + wrapper.vm.buttonClick(); // Assert - const link = wrapper.find("a"); - - expect(link.text()).toEqual("Terms of use"); + expect(wrapper.emitted()["ForwardClicked"][0]).toHaveBeenCalled; }); - it("Should return class btn-primary", async () => { + it("Should emit BackClicked on link click", async () => { // Act const wrapper = mount(funnelFooter, { - propsData: { - isPrimary: true, - }, }); - + wrapper.vm.linkClick(); // Assert - const input = wrapper.find("button"); - - // Expect - expect(input.attributes("class")).toContain("btn-primary"); + expect(wrapper.emitted()["BackClicked"][0]).toHaveBeenCalled; }); }); + +//Mock CMS content +const cmsContent = { + backLink: "text", + buttonText: "text", +};