43 lines
1.8 KiB
JavaScript
43 lines
1.8 KiB
JavaScript
import { shallowMount } from "@vue/test-utils";
|
|
import salesforceWebchat from "./salesforce-webchat.vue";
|
|
import * as devHelper from "./salesforce-helper-dev";
|
|
import * as qaHelper from "./salesforce-helper-qa";
|
|
import * as prodHelper from "./salesforce-helper-prod";
|
|
import { applicationConfig } from "../../constants/application-config";
|
|
|
|
describe("salesforceWebchat.vue", () => {
|
|
it("renders correctly", () => {
|
|
const wrapper = shallowMount(salesforceWebchat);
|
|
expect(wrapper.exists()).toBe(true);
|
|
});
|
|
|
|
it("has the correct default data", () => {
|
|
const wrapper = shallowMount(salesforceWebchat);
|
|
expect(wrapper.vm.$data).toEqual({});
|
|
});
|
|
|
|
it("has the correct default props", () => {
|
|
const wrapper = shallowMount(salesforceWebchat);
|
|
expect(wrapper.props().hideSalesforceWebchatLaunchButton).toBe(false);
|
|
});
|
|
|
|
it("calls the correct initialization function based on environment", () => {
|
|
applicationConfig.CURRENT_ENVIRONMENT = "Prod";
|
|
let wrapper = shallowMount(salesforceWebchat);
|
|
const mockProd = jest.spyOn(prodHelper, "initializeSalesforceWebchatForProd");
|
|
wrapper.vm.initializeSalesforceWebchat();
|
|
expect(mockProd).toHaveBeenCalled();
|
|
|
|
applicationConfig.CURRENT_ENVIRONMENT = "QA";
|
|
wrapper = shallowMount(salesforceWebchat);
|
|
const mockQa = jest.spyOn(qaHelper, "initializeSalesforceWebchatForQa");
|
|
wrapper.vm.initializeSalesforceWebchat();
|
|
expect(mockQa).toHaveBeenCalled();
|
|
|
|
applicationConfig.CURRENT_ENVIRONMENT = "Dev";
|
|
wrapper = shallowMount(salesforceWebchat);
|
|
const mockDev = jest.spyOn(devHelper, "initializeSalesforceWebchatForDev");
|
|
wrapper.vm.initializeSalesforceWebchat();
|
|
expect(mockDev).toHaveBeenCalled();
|
|
});
|
|
});
|