Update unit test.

This commit is contained in:
bmauger 2022-02-07 15:27:28 -05:00
parent bd25366d9e
commit f5c981e670

View file

@ -3,11 +3,12 @@ import textLink from "./text-link";
import { nextTick } from "vue"; import { nextTick } from "vue";
describe("text-link.vue", () => { describe("text-link.vue", () => {
it("Should return text-link type is navigation if prop navigation is true", async () => {
it("Should return class navigation-link", async () => {
// Act // Act
const wrapper = shallowMount(textLink, { const wrapper = shallowMount(textLink, {
propsData: { propsData: {
navigation: true, linkType: "navigation",
}, },
}); });
@ -18,11 +19,11 @@ describe("text-link.vue", () => {
expect(paragraph.attributes("class")).toContain("navigation-link"); expect(paragraph.attributes("class")).toContain("navigation-link");
}); });
it("Should return text-link type is footer if prop footer is true", async () => { it("Should return class footer", async () => {
// Act // Act
const wrapper = shallowMount(textLink, { const wrapper = shallowMount(textLink, {
propsData: { propsData: {
footer: true, linkType: "footer",
}, },
}); });
@ -30,14 +31,14 @@ describe("text-link.vue", () => {
const paragraph = wrapper.find("a"); const paragraph = wrapper.find("a");
// Expect // Expect
expect(paragraph.attributes("class")).toContain("footer-link"); expect(paragraph.attributes("class")).toContain("footer");
}); });
it("Should return text-link type is textSmall if prop textSmall is true", async () => { it("Should return class text-small", async () => {
// Act // Act
const wrapper = shallowMount(textLink, { const wrapper = shallowMount(textLink, {
propsData: { propsData: {
textSmall: true, linkType: "textSmall",
}, },
}); });
@ -48,18 +49,4 @@ describe("text-link.vue", () => {
expect(paragraph.attributes("class")).toContain("small"); expect(paragraph.attributes("class")).toContain("small");
}); });
it("Should return text for href", async () => {
// Act
const wrapper = shallowMount(textLink, {
propsData: {
text: "This is link text",
},
});
// Assert
const paragraph = wrapper.find("a");
// Expect
expect(paragraph.text()).toEqual("This is link text");
});
}); });