DigitalConsumer.ISS/src/iss-components/site-footer/site-footer.spec.js
Johan Gunawan 8ab9838425 SSR-199
2023-01-20 15:30:32 -05:00

43 lines
1.2 KiB
JavaScript

import { mount } from "@vue/test-utils";
import siteFooter from "./site-footer";
describe("site-footer.vue", () => {
it("Should emit ForwardClicked on button click", async () => {
// Act
const wrapper = mount(siteFooter, {
mixins: [mockMixin],
});
wrapper.vm.buttonClick();
// Assert
expect(wrapper.emitted()["forwardClicked"][0]).toHaveBeenCalled;
});
it("Should emit BackClicked on link click", async () => {
// Act
const wrapper = mount(siteFooter, {
mixins: [mockMixin],
});
wrapper.vm.linkClick();
// Assert
expect(wrapper.emitted()["backClicked"][0]).toHaveBeenCalled;
});
it("Should change button text when update button text is called", async () => {
// Act
const wrapper = mount(siteFooter, {
mixins: [mockMixin],
});
wrapper.vm.updateButtonText("newText");
// Assert
expect(wrapper.componentVM.customButtontext).toBe("newText");
});
});
const mockMixin = {
methods: {
getCmsContent: jest.fn(),
getPageNameByQueryString: jest.fn(() => "welcome-page"),
getFooterInfoBoxHeight: jest.fn(() => 80),
},
};