CASH-313 | Unit test and formatting
This commit is contained in:
parent
ec18956856
commit
323bcb4caf
2 changed files with 5 additions and 26 deletions
|
|
@ -2,12 +2,6 @@ import * as salesforceWebchatHelperdev from "./salesforce-helper-dev";
|
||||||
import * as salesforceWebchatHelperqa from "./salesforce-helper-qa";
|
import * as salesforceWebchatHelperqa from "./salesforce-helper-qa";
|
||||||
import * as salesforceWebchatHelperprod from "./salesforce-helper-prod";
|
import * as salesforceWebchatHelperprod from "./salesforce-helper-prod";
|
||||||
|
|
||||||
const mockEmbeddedSvc = {
|
|
||||||
settings: {},
|
|
||||||
init: jest.fn(),
|
|
||||||
testFlag: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
describe("Salesforce Webchat Helper Tests", () => {
|
describe("Salesforce Webchat Helper Tests", () => {
|
||||||
describe("Files and exposed methods exist", () => {
|
describe("Files and exposed methods exist", () => {
|
||||||
it("exposes initialization methods", () => {
|
it("exposes initialization methods", () => {
|
||||||
|
|
@ -21,23 +15,5 @@ describe("Salesforce Webchat Helper Tests", () => {
|
||||||
"function"
|
"function"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}),
|
});
|
||||||
describe("Custom code added correctly", () => {
|
|
||||||
it("defines a local variable 'embedded_svc' in the initESW method", () => {
|
|
||||||
mockEmbeddedSvc.testFlag = "dev";
|
|
||||||
window.embedded_svc = mockEmbeddedSvc;
|
|
||||||
salesforceWebchatHelperdev.initializeSalesforceWebchatForDev();
|
|
||||||
expect(embedded_svc.testFlag).toBe("dev");
|
|
||||||
|
|
||||||
mockEmbeddedSvc.testFlag = "qa";
|
|
||||||
window.embedded_svc = mockEmbeddedSvc;
|
|
||||||
salesforceWebchatHelperqa.initializeSalesforceWebchatForQa();
|
|
||||||
expect(embedded_svc.testFlag).toBe("qa");
|
|
||||||
|
|
||||||
mockEmbeddedSvc.testFlag = "prod";
|
|
||||||
window.embedded_svc = mockEmbeddedSvc;
|
|
||||||
salesforceWebchatHelperprod.initializeSalesforceWebchatForProd();
|
|
||||||
expect(embedded_svc.testFlag).toBe("prod");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,10 @@ describe("salesforceWebchat.vue", () => {
|
||||||
|
|
||||||
it("has the correct default data", () => {
|
it("has the correct default data", () => {
|
||||||
const wrapper = shallowMount(salesforceWebchat);
|
const wrapper = shallowMount(salesforceWebchat);
|
||||||
expect(wrapper.vm.$data).toEqual({});
|
expect(wrapper.vm.$data).toEqual({
|
||||||
|
isAgentAvailable: false,
|
||||||
|
isWebchatOpen: false,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has the correct default props", () => {
|
it("has the correct default props", () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue