CSR-666 Import store, cleanup
This commit is contained in:
parent
fd9267593b
commit
79072bb3b5
3 changed files with 13 additions and 21 deletions
|
|
@ -1,13 +1,15 @@
|
|||
import store from "@/store";
|
||||
|
||||
export default {
|
||||
methods: {
|
||||
hasSettingEqualTo(settingName, settingValue) {
|
||||
return this.$store.getters.experimentSettings[settingName] === settingValue;
|
||||
return store.getters.experimentSettings[settingName] === settingValue;
|
||||
},
|
||||
hasSetting(settingName) {
|
||||
return this.$store.getters.experimentSettings.hasOwnProperty(settingName);
|
||||
return store.getters.experimentSettings.hasOwnProperty(settingName);
|
||||
},
|
||||
getSettingValue(settingName) {
|
||||
return this.hasSetting(settingName) ? this.$store.getters.experimentSettings[settingName] : null;
|
||||
return this.hasSetting(settingName) ? store.getters.experimentSettings[settingName] : null;
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import experimentMixin from "@/mixins/experiment-mixin";
|
||||
import { shallowMount } from "@vue/test-utils";
|
||||
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||
import store from "@/store";
|
||||
|
||||
describe("experiment-mixin", () => {
|
||||
describe("hasSettingEqualTo", () => {
|
||||
|
|
@ -121,22 +122,20 @@ describe("experiment-mixin", () => {
|
|||
});
|
||||
|
||||
function setupMocks({ experimentSettings }) {
|
||||
const defaultExperimentSettings = experimentSettings ?? {
|
||||
const mocks = getMountOptions({});
|
||||
|
||||
const testExperimentSettings = {
|
||||
"Setting1": "Value1",
|
||||
"Setting2": "Value2",
|
||||
"Setting3": "Value3",
|
||||
"Setting4": "Value1",
|
||||
"Setting5": "Value2",
|
||||
"Setting6": "Value3"
|
||||
}
|
||||
};
|
||||
|
||||
const mocks = getMountOptions({
|
||||
store: {
|
||||
getters: {
|
||||
experimentSettings: defaultExperimentSettings
|
||||
}
|
||||
},
|
||||
});
|
||||
store.getters = {
|
||||
experimentSettings: experimentSettings ?? testExperimentSettings
|
||||
};
|
||||
|
||||
const mockComponent = {
|
||||
template: "<div></div>",
|
||||
|
|
|
|||
|
|
@ -895,23 +895,14 @@ function setupMocks({ partsOrQuestions = [] }) {
|
|||
router: {
|
||||
navigate: jest.fn()
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
const mockVinComponent = {
|
||||
components: { loadingModal },
|
||||
template: '<loadingModal ref="loadingModal" />',
|
||||
// render() {
|
||||
// return '<div ref="loadingModal"></div>'
|
||||
// },
|
||||
mixins: [vinPagesMixin, baseMixin.baseMixin]
|
||||
};
|
||||
|
||||
// const mockVinComponent = Vue.component("mockcomponent", {
|
||||
// template: '<loadingModal ref="loadingModal" />',
|
||||
// mixins: [vinPagesMixin, baseMixin.baseMixin]
|
||||
// })
|
||||
|
||||
const wrapper = shallowMount(mockVinComponent, mocks);
|
||||
|
||||
wrapper.vm.$refs.loadingModal.showModal = jest.fn();
|
||||
|
|
|
|||
Loading…
Reference in a new issue