Merge pull request #2461 from Safelite/feature/CASH-188
CASH-188 | Change way current env is determined
This commit is contained in:
commit
a7bab926c4
3 changed files with 6 additions and 13 deletions
|
|
@ -52,7 +52,6 @@ export function initializeSalesforceWebchatForQa() {
|
|||
};
|
||||
|
||||
if (!window.embedded_svc) {
|
||||
console.log("no embedded svc found");
|
||||
var s = document.createElement("script");
|
||||
s.setAttribute(
|
||||
"src",
|
||||
|
|
@ -63,7 +62,6 @@ export function initializeSalesforceWebchatForQa() {
|
|||
};
|
||||
document.body.appendChild(s);
|
||||
} else {
|
||||
console.log("embedded svc found");
|
||||
initESW("https://service.force.com");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ 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", () => {
|
||||
|
|
@ -21,19 +22,19 @@ describe("salesforceWebchat.vue", () => {
|
|||
});
|
||||
|
||||
it("calls the correct initialization function based on environment", () => {
|
||||
process.env.VUE_APP_CURRENT_ENVIRONMENT = "Prod";
|
||||
applicationConfig.CURRENT_ENVIRONMENT = "Prod";
|
||||
let wrapper = shallowMount(salesforceWebchat);
|
||||
mockProd = jest.spyOn(prodHelper, "initializeSalesforceWebchatForProd");
|
||||
wrapper.vm.initializeSalesforceWebchat();
|
||||
expect(mockProd).toHaveBeenCalled();
|
||||
|
||||
process.env.VUE_APP_CURRENT_ENVIRONMENT = "QA";
|
||||
applicationConfig.CURRENT_ENVIRONMENT = "QA";
|
||||
wrapper = shallowMount(salesforceWebchat);
|
||||
mockQa = jest.spyOn(qaHelper, "initializeSalesforceWebchatForQa");
|
||||
wrapper.vm.initializeSalesforceWebchat();
|
||||
expect(mockQa).toHaveBeenCalled();
|
||||
|
||||
process.env.VUE_APP_CURRENT_ENVIRONMENT = "Dev";
|
||||
applicationConfig.CURRENT_ENVIRONMENT = "Dev";
|
||||
wrapper = shallowMount(salesforceWebchat);
|
||||
mockDev = jest.spyOn(devHelper, "initializeSalesforceWebchatForDev");
|
||||
wrapper.vm.initializeSalesforceWebchat();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
import { initializeSalesforceWebchatForDev } from "./salesforce-helper-dev";
|
||||
import { initializeSalesforceWebchatForQa } from "./salesforce-helper-qa";
|
||||
import { initializeSalesforceWebchatForProd } from "./salesforce-helper-prod";
|
||||
import { applicationConfig } from "@/constants/application-config";
|
||||
|
||||
export default {
|
||||
name: "salesforceWebchat",
|
||||
|
|
@ -28,23 +29,16 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
initializeSalesforceWebchat() {
|
||||
console.log(
|
||||
"process.env.VUE_APP_CURRENT_ENVIRONMENT",
|
||||
process.env.VUE_APP_CURRENT_ENVIRONMENT
|
||||
);
|
||||
switch (process.env.VUE_APP_CURRENT_ENVIRONMENT) {
|
||||
switch (applicationConfig.CURRENT_ENVIRONMENT) {
|
||||
case "Prod":
|
||||
console.log("Prod");
|
||||
initializeSalesforceWebchatForProd();
|
||||
break;
|
||||
case "QA":
|
||||
case "SysTest":
|
||||
console.log("QA");
|
||||
initializeSalesforceWebchatForQa();
|
||||
break;
|
||||
case "Dev":
|
||||
case "Localhost":
|
||||
console.log("Dev");
|
||||
initializeSalesforceWebchatForDev();
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue