Commit 072b39d4 authored by Illya Klymov's avatar Illya Klymov Committed by Vitaly Slobodin

Fix deprecated methods in reports tests

parent 2df757d7
...@@ -7,10 +7,11 @@ import state from './state'; ...@@ -7,10 +7,11 @@ import state from './state';
Vue.use(Vuex); Vue.use(Vuex);
export default initialState => export const getStoreConfig = initialState => ({
new Vuex.Store({ actions,
actions, getters,
getters, mutations,
mutations, state: state(initialState),
state: state(initialState), });
});
export default initialState => new Vuex.Store(getStoreConfig(initialState));
...@@ -7,10 +7,11 @@ import state from './state'; ...@@ -7,10 +7,11 @@ import state from './state';
Vue.use(Vuex); Vue.use(Vuex);
export default initialState => export const getStoreConfig = initialState => ({
new Vuex.Store({ actions,
actions, getters,
getters, mutations,
mutations, state: state(initialState),
state: state(initialState), });
});
export default initialState => new Vuex.Store(getStoreConfig(initialState));
...@@ -7,10 +7,11 @@ import state from './state'; ...@@ -7,10 +7,11 @@ import state from './state';
Vue.use(Vuex); Vue.use(Vuex);
export default () => export const getStoreConfig = () => ({
new Vuex.Store({ actions,
actions, mutations,
mutations, getters,
getters, state: state(),
state: state(), });
});
export default () => new Vuex.Store(getStoreConfig());
...@@ -2,7 +2,7 @@ import { mount, createLocalVue } from '@vue/test-utils'; ...@@ -2,7 +2,7 @@ import { mount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import GroupedAccessibilityReportsApp from '~/reports/accessibility_report/grouped_accessibility_reports_app.vue'; import GroupedAccessibilityReportsApp from '~/reports/accessibility_report/grouped_accessibility_reports_app.vue';
import AccessibilityIssueBody from '~/reports/accessibility_report/components/accessibility_issue_body.vue'; import AccessibilityIssueBody from '~/reports/accessibility_report/components/accessibility_issue_body.vue';
import store from '~/reports/accessibility_report/store'; import { getStoreConfig } from '~/reports/accessibility_report/store';
import { mockReport } from './mock_data'; import { mockReport } from './mock_data';
const localVue = createLocalVue(); const localVue = createLocalVue();
...@@ -20,16 +20,17 @@ describe('Grouped accessibility reports app', () => { ...@@ -20,16 +20,17 @@ describe('Grouped accessibility reports app', () => {
propsData: { propsData: {
endpoint: 'endpoint.json', endpoint: 'endpoint.json',
}, },
methods: {
fetchReport: () => {},
},
}); });
}; };
const findHeader = () => wrapper.find('[data-testid="report-section-code-text"]'); const findHeader = () => wrapper.find('[data-testid="report-section-code-text"]');
beforeEach(() => { beforeEach(() => {
mockStore = store(); mockStore = new Vuex.Store({
...getStoreConfig(),
actions: { fetchReport: () => {}, setEndpoint: () => {} },
});
mountComponent(); mountComponent();
}); });
......
...@@ -2,7 +2,7 @@ import { mount, createLocalVue } from '@vue/test-utils'; ...@@ -2,7 +2,7 @@ import { mount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import GroupedCodequalityReportsApp from '~/reports/codequality_report/grouped_codequality_reports_app.vue'; import GroupedCodequalityReportsApp from '~/reports/codequality_report/grouped_codequality_reports_app.vue';
import CodequalityIssueBody from '~/reports/codequality_report/components/codequality_issue_body.vue'; import CodequalityIssueBody from '~/reports/codequality_report/components/codequality_issue_body.vue';
import store from '~/reports/codequality_report/store'; import { getStoreConfig } from '~/reports/codequality_report/store';
import { mockParsedHeadIssues, mockParsedBaseIssues } from './mock_data'; import { mockParsedHeadIssues, mockParsedBaseIssues } from './mock_data';
const localVue = createLocalVue(); const localVue = createLocalVue();
...@@ -13,21 +13,22 @@ describe('Grouped code quality reports app', () => { ...@@ -13,21 +13,22 @@ describe('Grouped code quality reports app', () => {
let wrapper; let wrapper;
let mockStore; let mockStore;
const PATHS = {
codequalityHelpPath: 'codequality_help.html',
basePath: 'base.json',
headPath: 'head.json',
baseBlobPath: 'base/blob/path/',
headBlobPath: 'head/blob/path/',
};
const mountComponent = (props = {}) => { const mountComponent = (props = {}) => {
wrapper = mount(Component, { wrapper = mount(Component, {
store: mockStore, store: mockStore,
localVue, localVue,
propsData: { propsData: {
basePath: 'base.json', ...PATHS,
headPath: 'head.json',
baseBlobPath: 'base/blob/path/',
headBlobPath: 'head/blob/path/',
codequalityHelpPath: 'codequality_help.html',
...props, ...props,
}, },
methods: {
fetchReports: () => {},
},
}); });
}; };
...@@ -35,7 +36,19 @@ describe('Grouped code quality reports app', () => { ...@@ -35,7 +36,19 @@ describe('Grouped code quality reports app', () => {
const findIssueBody = () => wrapper.find(CodequalityIssueBody); const findIssueBody = () => wrapper.find(CodequalityIssueBody);
beforeEach(() => { beforeEach(() => {
mockStore = store(); const { state, ...storeConfig } = getStoreConfig();
mockStore = new Vuex.Store({
...storeConfig,
actions: {
setPaths: () => {},
fetchReports: () => {},
},
state: {
...state,
...PATHS,
},
});
mountComponent(); mountComponent();
}); });
......
import { mount, createLocalVue } from '@vue/test-utils'; import { mount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import GroupedTestReportsApp from '~/reports/components/grouped_test_reports_app.vue'; import GroupedTestReportsApp from '~/reports/components/grouped_test_reports_app.vue';
import store from '~/reports/store'; import { getStoreConfig } from '~/reports/store';
import { failedReport } from '../mock_data/mock_data'; import { failedReport } from '../mock_data/mock_data';
import successTestReports from '../mock_data/no_failures_report.json'; import successTestReports from '../mock_data/no_failures_report.json';
...@@ -29,9 +29,6 @@ describe('Grouped test reports app', () => { ...@@ -29,9 +29,6 @@ describe('Grouped test reports app', () => {
pipelinePath, pipelinePath,
...props, ...props,
}, },
methods: {
fetchReports: () => {},
},
}); });
}; };
...@@ -49,7 +46,13 @@ describe('Grouped test reports app', () => { ...@@ -49,7 +46,13 @@ describe('Grouped test reports app', () => {
wrapper.findAll('[data-testid="test-issue-body-description"]'); wrapper.findAll('[data-testid="test-issue-body-description"]');
beforeEach(() => { beforeEach(() => {
mockStore = store(); mockStore = new Vuex.Store({
...getStoreConfig(),
actions: {
fetchReports: () => {},
setEndpoint: () => {},
},
});
mountComponent(); mountComponent();
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment