Commit 07a36d1e authored by Nathan Friend's avatar Nathan Friend Committed by Olena Horal-Koretska

Rename release Vuex store modules

Updates the name of the Vuex store modules used on the releases pages.

"list" is now "index", "detail" is now "editNew".
parent 401c77ab
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
TagField, TagField,
}, },
computed: { computed: {
...mapState('detail', [ ...mapState('editNew', [
'isFetchingRelease', 'isFetchingRelease',
'isUpdatingRelease', 'isUpdatingRelease',
'fetchError', 'fetchError',
...@@ -36,13 +36,13 @@ export default { ...@@ -36,13 +36,13 @@ export default {
'groupId', 'groupId',
'groupMilestonesAvailable', 'groupMilestonesAvailable',
]), ]),
...mapGetters('detail', ['isValid', 'isExistingRelease']), ...mapGetters('editNew', ['isValid', 'isExistingRelease']),
showForm() { showForm() {
return Boolean(!this.isFetchingRelease && !this.fetchError && this.release); return Boolean(!this.isFetchingRelease && !this.fetchError && this.release);
}, },
releaseTitle: { releaseTitle: {
get() { get() {
return this.$store.state.detail.release.name; return this.$store.state.editNew.release.name;
}, },
set(title) { set(title) {
this.updateReleaseTitle(title); this.updateReleaseTitle(title);
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
}, },
releaseNotes: { releaseNotes: {
get() { get() {
return this.$store.state.detail.release.description; return this.$store.state.editNew.release.description;
}, },
set(notes) { set(notes) {
this.updateReleaseNotes(notes); this.updateReleaseNotes(notes);
...@@ -58,7 +58,7 @@ export default { ...@@ -58,7 +58,7 @@ export default {
}, },
releaseMilestones: { releaseMilestones: {
get() { get() {
return this.$store.state.detail.release.milestones; return this.$store.state.editNew.release.milestones;
}, },
set(milestones) { set(milestones) {
this.updateReleaseMilestones(milestones); this.updateReleaseMilestones(milestones);
...@@ -93,7 +93,7 @@ export default { ...@@ -93,7 +93,7 @@ export default {
this.$el.querySelector('input:enabled, button:enabled').focus(); this.$el.querySelector('input:enabled, button:enabled').focus();
}, },
methods: { methods: {
...mapActions('detail', [ ...mapActions('editNew', [
'initializeRelease', 'initializeRelease',
'saveRelease', 'saveRelease',
'updateReleaseTitle', 'updateReleaseTitle',
......
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
ReleasesSort, ReleasesSort,
}, },
computed: { computed: {
...mapState('list', [ ...mapState('index', [
'documentationPath', 'documentationPath',
'illustrationPath', 'illustrationPath',
'newReleasePath', 'newReleasePath',
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
window.addEventListener('popstate', this.fetchReleases); window.addEventListener('popstate', this.fetchReleases);
}, },
methods: { methods: {
...mapActions('list', { ...mapActions('index', {
fetchReleasesStoreAction: 'fetchReleases', fetchReleasesStoreAction: 'fetchReleases',
}), }),
fetchReleases() { fetchReleases() {
......
...@@ -26,14 +26,14 @@ export default { ...@@ -26,14 +26,14 @@ export default {
}, },
directives: { GlTooltip: GlTooltipDirective }, directives: { GlTooltip: GlTooltipDirective },
computed: { computed: {
...mapState('detail', ['release', 'releaseAssetsDocsPath']), ...mapState('editNew', ['release', 'releaseAssetsDocsPath']),
...mapGetters('detail', ['validationErrors']), ...mapGetters('editNew', ['validationErrors']),
}, },
created() { created() {
this.ensureAtLeastOneLink(); this.ensureAtLeastOneLink();
}, },
methods: { methods: {
...mapActions('detail', [ ...mapActions('editNew', [
'addEmptyAssetLink', 'addEmptyAssetLink',
'updateAssetLinkUrl', 'updateAssetLinkUrl',
'updateAssetLinkName', 'updateAssetLinkName',
......
...@@ -7,13 +7,13 @@ export default { ...@@ -7,13 +7,13 @@ export default {
name: 'ReleasesPaginationGraphql', name: 'ReleasesPaginationGraphql',
components: { GlKeysetPagination }, components: { GlKeysetPagination },
computed: { computed: {
...mapState('list', ['graphQlPageInfo']), ...mapState('index', ['graphQlPageInfo']),
showPagination() { showPagination() {
return this.graphQlPageInfo.hasPreviousPage || this.graphQlPageInfo.hasNextPage; return this.graphQlPageInfo.hasPreviousPage || this.graphQlPageInfo.hasNextPage;
}, },
}, },
methods: { methods: {
...mapActions('list', ['fetchReleases']), ...mapActions('index', ['fetchReleases']),
onPrev(before) { onPrev(before) {
historyPushState(buildUrlWithCurrentLocation(`?before=${before}`)); historyPushState(buildUrlWithCurrentLocation(`?before=${before}`));
this.fetchReleases({ before }); this.fetchReleases({ before });
......
...@@ -7,10 +7,10 @@ export default { ...@@ -7,10 +7,10 @@ export default {
name: 'ReleasesPaginationRest', name: 'ReleasesPaginationRest',
components: { TablePagination }, components: { TablePagination },
computed: { computed: {
...mapState('list', ['restPageInfo']), ...mapState('index', ['restPageInfo']),
}, },
methods: { methods: {
...mapActions('list', ['fetchReleases']), ...mapActions('index', ['fetchReleases']),
onChangePage(page) { onChangePage(page) {
historyPushState(buildUrlWithCurrentLocation(`?page=${page}`)); historyPushState(buildUrlWithCurrentLocation(`?page=${page}`));
this.fetchReleases({ page }); this.fetchReleases({ page });
......
...@@ -10,7 +10,7 @@ export default { ...@@ -10,7 +10,7 @@ export default {
GlSortingItem, GlSortingItem,
}, },
computed: { computed: {
...mapState('list', { ...mapState('index', {
orderBy: (state) => state.sorting.orderBy, orderBy: (state) => state.sorting.orderBy,
sort: (state) => state.sorting.sort, sort: (state) => state.sorting.sort,
}), }),
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
}, },
}, },
methods: { methods: {
...mapActions('list', ['setSorting']), ...mapActions('index', ['setSorting']),
onDirectionChange() { onDirectionChange() {
const sort = this.isSortAscending ? DESCENDING_ORDER : ASCENDING_ODER; const sort = this.isSortAscending ? DESCENDING_ORDER : ASCENDING_ODER;
this.setSorting({ sort }); this.setSorting({ sort });
......
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
TagFieldNew, TagFieldNew,
}, },
computed: { computed: {
...mapGetters('detail', ['isExistingRelease']), ...mapGetters('editNew', ['isExistingRelease']),
}, },
}; };
</script> </script>
......
...@@ -8,7 +8,7 @@ export default { ...@@ -8,7 +8,7 @@ export default {
name: 'TagFieldExisting', name: 'TagFieldExisting',
components: { GlFormGroup, GlFormInput, FormFieldContainer }, components: { GlFormGroup, GlFormInput, FormFieldContainer },
computed: { computed: {
...mapState('detail', ['release']), ...mapState('editNew', ['release']),
inputId() { inputId() {
return uniqueId('tag-name-input-'); return uniqueId('tag-name-input-');
}, },
......
...@@ -27,8 +27,8 @@ export default { ...@@ -27,8 +27,8 @@ export default {
}; };
}, },
computed: { computed: {
...mapState('detail', ['projectId', 'release', 'createFrom']), ...mapState('editNew', ['projectId', 'release', 'createFrom']),
...mapGetters('detail', ['validationErrors']), ...mapGetters('editNew', ['validationErrors']),
tagName: { tagName: {
get() { get() {
return this.release.tagName; return this.release.tagName;
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
}, },
}, },
methods: { methods: {
...mapActions('detail', ['updateReleaseTagName', 'updateCreateFrom']), ...mapActions('editNew', ['updateReleaseTagName', 'updateCreateFrom']),
markInputAsDirty() { markInputAsDirty() {
this.isInputDirty = true; this.isInputDirty = true;
}, },
......
...@@ -2,7 +2,7 @@ import Vue from 'vue'; ...@@ -2,7 +2,7 @@ import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import ReleaseEditNewApp from './components/app_edit_new.vue'; import ReleaseEditNewApp from './components/app_edit_new.vue';
import createStore from './stores'; import createStore from './stores';
import createDetailModule from './stores/modules/detail'; import createEditNewModule from './stores/modules/edit_new';
Vue.use(Vuex); Vue.use(Vuex);
...@@ -11,7 +11,7 @@ export default () => { ...@@ -11,7 +11,7 @@ export default () => {
const store = createStore({ const store = createStore({
modules: { modules: {
detail: createDetailModule(el.dataset), editNew: createEditNewModule(el.dataset),
}, },
}); });
......
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import ReleaseListApp from './components/app_index.vue'; import ReleaseIndexApp from './components/app_index.vue';
import createStore from './stores'; import createStore from './stores';
import createListModule from './stores/modules/list'; import createIndexModule from './stores/modules/index';
Vue.use(Vuex); Vue.use(Vuex);
...@@ -13,7 +13,7 @@ export default () => { ...@@ -13,7 +13,7 @@ export default () => {
el, el,
store: createStore({ store: createStore({
modules: { modules: {
list: createListModule(el.dataset), index: createIndexModule(el.dataset),
}, },
featureFlags: { featureFlags: {
graphqlReleaseData: Boolean(gon.features?.graphqlReleaseData), graphqlReleaseData: Boolean(gon.features?.graphqlReleaseData),
...@@ -21,6 +21,6 @@ export default () => { ...@@ -21,6 +21,6 @@ export default () => {
graphqlMilestoneStats: Boolean(gon.features?.graphqlMilestoneStats), graphqlMilestoneStats: Boolean(gon.features?.graphqlMilestoneStats),
}, },
}), }),
render: (h) => h(ReleaseListApp), render: (h) => h(ReleaseIndexApp),
}); });
}; };
...@@ -2,7 +2,7 @@ import Vue from 'vue'; ...@@ -2,7 +2,7 @@ import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import ReleaseEditNewApp from './components/app_edit_new.vue'; import ReleaseEditNewApp from './components/app_edit_new.vue';
import createStore from './stores'; import createStore from './stores';
import createDetailModule from './stores/modules/detail'; import createEditNewModule from './stores/modules/edit_new';
Vue.use(Vuex); Vue.use(Vuex);
...@@ -11,7 +11,7 @@ export default () => { ...@@ -11,7 +11,7 @@ export default () => {
const store = createStore({ const store = createStore({
modules: { modules: {
detail: createDetailModule(el.dataset), editNew: createEditNewModule(el.dataset),
}, },
}); });
......
...@@ -50,7 +50,7 @@ describe('Release edit/new component', () => { ...@@ -50,7 +50,7 @@ describe('Release edit/new component', () => {
merge( merge(
{ {
modules: { modules: {
detail: { editNew: {
namespaced: true, namespaced: true,
actions, actions,
state, state,
...@@ -168,7 +168,7 @@ describe('Release edit/new component', () => { ...@@ -168,7 +168,7 @@ describe('Release edit/new component', () => {
await factory({ await factory({
store: { store: {
modules: { modules: {
detail: { editNew: {
getters: { getters: {
isExistingRelease: () => false, isExistingRelease: () => false,
}, },
...@@ -207,7 +207,7 @@ describe('Release edit/new component', () => { ...@@ -207,7 +207,7 @@ describe('Release edit/new component', () => {
await factory({ await factory({
store: { store: {
modules: { modules: {
detail: { editNew: {
getters: { getters: {
isValid: () => true, isValid: () => true,
}, },
...@@ -227,7 +227,7 @@ describe('Release edit/new component', () => { ...@@ -227,7 +227,7 @@ describe('Release edit/new component', () => {
await factory({ await factory({
store: { store: {
modules: { modules: {
detail: { editNew: {
getters: { getters: {
isValid: () => false, isValid: () => false,
}, },
......
...@@ -8,7 +8,7 @@ import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; ...@@ -8,7 +8,7 @@ import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import ReleasesApp from '~/releases/components/app_index.vue'; import ReleasesApp from '~/releases/components/app_index.vue';
import ReleasesPagination from '~/releases/components/releases_pagination.vue'; import ReleasesPagination from '~/releases/components/releases_pagination.vue';
import createStore from '~/releases/stores'; import createStore from '~/releases/stores';
import createListModule from '~/releases/stores/modules/list'; import createIndexModule from '~/releases/stores/modules/index';
import { pageInfoHeadersWithoutPagination, pageInfoHeadersWithPagination } from '../mock_data'; import { pageInfoHeadersWithoutPagination, pageInfoHeadersWithPagination } from '../mock_data';
jest.mock('~/lib/utils/common_utils', () => ({ jest.mock('~/lib/utils/common_utils', () => ({
...@@ -41,15 +41,15 @@ describe('Releases App ', () => { ...@@ -41,15 +41,15 @@ describe('Releases App ', () => {
}; };
const createComponent = (stateUpdates = {}) => { const createComponent = (stateUpdates = {}) => {
const listModule = createListModule({ const indexModule = createIndexModule({
...defaultInitialState, ...defaultInitialState,
...stateUpdates, ...stateUpdates,
}); });
fetchReleaseSpy = jest.spyOn(listModule.actions, 'fetchReleases'); fetchReleaseSpy = jest.spyOn(indexModule.actions, 'fetchReleases');
const store = createStore({ const store = createStore({
modules: { list: listModule }, modules: { index: indexModule },
featureFlags: { featureFlags: {
graphqlReleaseData: true, graphqlReleaseData: true,
graphqlReleasesPage: false, graphqlReleasesPage: false,
......
...@@ -44,7 +44,7 @@ describe('Release edit component', () => { ...@@ -44,7 +44,7 @@ describe('Release edit component', () => {
const store = new Vuex.Store({ const store = new Vuex.Store({
modules: { modules: {
detail: { editNew: {
namespaced: true, namespaced: true,
actions, actions,
state, state,
......
...@@ -3,7 +3,7 @@ import Vuex from 'vuex'; ...@@ -3,7 +3,7 @@ import Vuex from 'vuex';
import { historyPushState } from '~/lib/utils/common_utils'; import { historyPushState } from '~/lib/utils/common_utils';
import ReleasesPaginationGraphql from '~/releases/components/releases_pagination_graphql.vue'; import ReleasesPaginationGraphql from '~/releases/components/releases_pagination_graphql.vue';
import createStore from '~/releases/stores'; import createStore from '~/releases/stores';
import createListModule from '~/releases/stores/modules/list'; import createIndexModule from '~/releases/stores/modules/index';
jest.mock('~/lib/utils/common_utils', () => ({ jest.mock('~/lib/utils/common_utils', () => ({
...jest.requireActual('~/lib/utils/common_utils'), ...jest.requireActual('~/lib/utils/common_utils'),
...@@ -15,7 +15,7 @@ localVue.use(Vuex); ...@@ -15,7 +15,7 @@ localVue.use(Vuex);
describe('~/releases/components/releases_pagination_graphql.vue', () => { describe('~/releases/components/releases_pagination_graphql.vue', () => {
let wrapper; let wrapper;
let listModule; let indexModule;
const cursors = { const cursors = {
startCursor: 'startCursor', startCursor: 'startCursor',
...@@ -25,16 +25,16 @@ describe('~/releases/components/releases_pagination_graphql.vue', () => { ...@@ -25,16 +25,16 @@ describe('~/releases/components/releases_pagination_graphql.vue', () => {
const projectPath = 'my/project'; const projectPath = 'my/project';
const createComponent = (pageInfo) => { const createComponent = (pageInfo) => {
listModule = createListModule({ projectPath }); indexModule = createIndexModule({ projectPath });
listModule.state.graphQlPageInfo = pageInfo; indexModule.state.graphQlPageInfo = pageInfo;
listModule.actions.fetchReleases = jest.fn(); indexModule.actions.fetchReleases = jest.fn();
wrapper = mount(ReleasesPaginationGraphql, { wrapper = mount(ReleasesPaginationGraphql, {
store: createStore({ store: createStore({
modules: { modules: {
list: listModule, index: indexModule,
}, },
featureFlags: {}, featureFlags: {},
}), }),
...@@ -142,7 +142,7 @@ describe('~/releases/components/releases_pagination_graphql.vue', () => { ...@@ -142,7 +142,7 @@ describe('~/releases/components/releases_pagination_graphql.vue', () => {
}); });
it('calls fetchReleases with the correct after cursor', () => { it('calls fetchReleases with the correct after cursor', () => {
expect(listModule.actions.fetchReleases.mock.calls).toEqual([ expect(indexModule.actions.fetchReleases.mock.calls).toEqual([
[expect.anything(), { after: cursors.endCursor }], [expect.anything(), { after: cursors.endCursor }],
]); ]);
}); });
...@@ -160,7 +160,7 @@ describe('~/releases/components/releases_pagination_graphql.vue', () => { ...@@ -160,7 +160,7 @@ describe('~/releases/components/releases_pagination_graphql.vue', () => {
}); });
it('calls fetchReleases with the correct before cursor', () => { it('calls fetchReleases with the correct before cursor', () => {
expect(listModule.actions.fetchReleases.mock.calls).toEqual([ expect(indexModule.actions.fetchReleases.mock.calls).toEqual([
[expect.anything(), { before: cursors.startCursor }], [expect.anything(), { before: cursors.startCursor }],
]); ]);
}); });
......
...@@ -4,7 +4,7 @@ import Vuex from 'vuex'; ...@@ -4,7 +4,7 @@ import Vuex from 'vuex';
import * as commonUtils from '~/lib/utils/common_utils'; import * as commonUtils from '~/lib/utils/common_utils';
import ReleasesPaginationRest from '~/releases/components/releases_pagination_rest.vue'; import ReleasesPaginationRest from '~/releases/components/releases_pagination_rest.vue';
import createStore from '~/releases/stores'; import createStore from '~/releases/stores';
import createListModule from '~/releases/stores/modules/list'; import createIndexModule from '~/releases/stores/modules/index';
commonUtils.historyPushState = jest.fn(); commonUtils.historyPushState = jest.fn();
...@@ -13,21 +13,21 @@ localVue.use(Vuex); ...@@ -13,21 +13,21 @@ localVue.use(Vuex);
describe('~/releases/components/releases_pagination_rest.vue', () => { describe('~/releases/components/releases_pagination_rest.vue', () => {
let wrapper; let wrapper;
let listModule; let indexModule;
const projectId = 19; const projectId = 19;
const createComponent = (pageInfo) => { const createComponent = (pageInfo) => {
listModule = createListModule({ projectId }); indexModule = createIndexModule({ projectId });
listModule.state.restPageInfo = pageInfo; indexModule.state.restPageInfo = pageInfo;
listModule.actions.fetchReleases = jest.fn(); indexModule.actions.fetchReleases = jest.fn();
wrapper = mount(ReleasesPaginationRest, { wrapper = mount(ReleasesPaginationRest, {
store: createStore({ store: createStore({
modules: { modules: {
list: listModule, index: indexModule,
}, },
featureFlags: {}, featureFlags: {},
}), }),
...@@ -58,7 +58,7 @@ describe('~/releases/components/releases_pagination_rest.vue', () => { ...@@ -58,7 +58,7 @@ describe('~/releases/components/releases_pagination_rest.vue', () => {
}); });
it('calls fetchReleases with the correct page', () => { it('calls fetchReleases with the correct page', () => {
expect(listModule.actions.fetchReleases.mock.calls).toEqual([ expect(indexModule.actions.fetchReleases.mock.calls).toEqual([
[expect.anything(), { page: newPage }], [expect.anything(), { page: newPage }],
]); ]);
}); });
......
...@@ -3,7 +3,7 @@ import { shallowMount, createLocalVue } from '@vue/test-utils'; ...@@ -3,7 +3,7 @@ import { shallowMount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import ReleasesSort from '~/releases/components/releases_sort.vue'; import ReleasesSort from '~/releases/components/releases_sort.vue';
import createStore from '~/releases/stores'; import createStore from '~/releases/stores';
import createListModule from '~/releases/stores/modules/list'; import createIndexModule from '~/releases/stores/modules/index';
const localVue = createLocalVue(); const localVue = createLocalVue();
localVue.use(Vuex); localVue.use(Vuex);
...@@ -11,15 +11,15 @@ localVue.use(Vuex); ...@@ -11,15 +11,15 @@ localVue.use(Vuex);
describe('~/releases/components/releases_sort.vue', () => { describe('~/releases/components/releases_sort.vue', () => {
let wrapper; let wrapper;
let store; let store;
let listModule; let indexModule;
const projectId = 8; const projectId = 8;
const createComponent = () => { const createComponent = () => {
listModule = createListModule({ projectId }); indexModule = createIndexModule({ projectId });
store = createStore({ store = createStore({
modules: { modules: {
list: listModule, index: indexModule,
}, },
}); });
...@@ -52,7 +52,7 @@ describe('~/releases/components/releases_sort.vue', () => { ...@@ -52,7 +52,7 @@ describe('~/releases/components/releases_sort.vue', () => {
it('on sort change set sorting in vuex and emit event', () => { it('on sort change set sorting in vuex and emit event', () => {
findReleasesSorting().vm.$emit('sortDirectionChange'); findReleasesSorting().vm.$emit('sortDirectionChange');
expect(store.dispatch).toHaveBeenCalledWith('list/setSorting', { sort: 'asc' }); expect(store.dispatch).toHaveBeenCalledWith('index/setSorting', { sort: 'asc' });
expect(wrapper.emitted('sort:changed')).toBeTruthy(); expect(wrapper.emitted('sort:changed')).toBeTruthy();
}); });
...@@ -60,7 +60,7 @@ describe('~/releases/components/releases_sort.vue', () => { ...@@ -60,7 +60,7 @@ describe('~/releases/components/releases_sort.vue', () => {
const item = findSortingItems().at(0); const item = findSortingItems().at(0);
const { orderBy } = wrapper.vm.sortOptions[0]; const { orderBy } = wrapper.vm.sortOptions[0];
item.vm.$emit('click'); item.vm.$emit('click');
expect(store.dispatch).toHaveBeenCalledWith('list/setSorting', { orderBy }); expect(store.dispatch).toHaveBeenCalledWith('index/setSorting', { orderBy });
expect(wrapper.emitted('sort:changed')).toBeTruthy(); expect(wrapper.emitted('sort:changed')).toBeTruthy();
}); });
}); });
...@@ -3,7 +3,7 @@ import { shallowMount, mount, createLocalVue } from '@vue/test-utils'; ...@@ -3,7 +3,7 @@ import { shallowMount, mount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import TagFieldExisting from '~/releases/components/tag_field_existing.vue'; import TagFieldExisting from '~/releases/components/tag_field_existing.vue';
import createStore from '~/releases/stores'; import createStore from '~/releases/stores';
import createDetailModule from '~/releases/stores/modules/detail'; import createEditNewModule from '~/releases/stores/modules/edit_new';
const TEST_TAG_NAME = 'test-tag-name'; const TEST_TAG_NAME = 'test-tag-name';
...@@ -27,13 +27,13 @@ describe('releases/components/tag_field_existing', () => { ...@@ -27,13 +27,13 @@ describe('releases/components/tag_field_existing', () => {
beforeEach(() => { beforeEach(() => {
store = createStore({ store = createStore({
modules: { modules: {
detail: createDetailModule({ editNew: createEditNewModule({
tagName: TEST_TAG_NAME, tagName: TEST_TAG_NAME,
}), }),
}, },
}); });
store.state.detail.release = { store.state.editNew.release = {
tagName: TEST_TAG_NAME, tagName: TEST_TAG_NAME,
}; };
}); });
......
...@@ -3,7 +3,7 @@ import { mount, shallowMount } from '@vue/test-utils'; ...@@ -3,7 +3,7 @@ import { mount, shallowMount } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import TagFieldNew from '~/releases/components/tag_field_new.vue'; import TagFieldNew from '~/releases/components/tag_field_new.vue';
import createStore from '~/releases/stores'; import createStore from '~/releases/stores';
import createDetailModule from '~/releases/stores/modules/detail'; import createEditNewModule from '~/releases/stores/modules/edit_new';
const TEST_TAG_NAME = 'test-tag-name'; const TEST_TAG_NAME = 'test-tag-name';
const TEST_PROJECT_ID = '1234'; const TEST_PROJECT_ID = '1234';
...@@ -44,15 +44,15 @@ describe('releases/components/tag_field_new', () => { ...@@ -44,15 +44,15 @@ describe('releases/components/tag_field_new', () => {
beforeEach(() => { beforeEach(() => {
store = createStore({ store = createStore({
modules: { modules: {
detail: createDetailModule({ editNew: createEditNewModule({
projectId: TEST_PROJECT_ID, projectId: TEST_PROJECT_ID,
}), }),
}, },
}); });
store.state.detail.createFrom = TEST_CREATE_FROM; store.state.editNew.createFrom = TEST_CREATE_FROM;
store.state.detail.release = { store.state.editNew.release = {
tagName: TEST_TAG_NAME, tagName: TEST_TAG_NAME,
assets: { assets: {
links: [], links: [],
...@@ -89,7 +89,7 @@ describe('releases/components/tag_field_new', () => { ...@@ -89,7 +89,7 @@ describe('releases/components/tag_field_new', () => {
}); });
it("updates the store's release.tagName property", () => { it("updates the store's release.tagName property", () => {
expect(store.state.detail.release.tagName).toBe(NONEXISTENT_TAG_NAME); expect(store.state.editNew.release.tagName).toBe(NONEXISTENT_TAG_NAME);
}); });
it('hides the "Create from" field', () => { it('hides the "Create from" field', () => {
...@@ -107,7 +107,7 @@ describe('releases/components/tag_field_new', () => { ...@@ -107,7 +107,7 @@ describe('releases/components/tag_field_new', () => {
}); });
it("updates the store's release.tagName property", () => { it("updates the store's release.tagName property", () => {
expect(store.state.detail.release.tagName).toBe(updatedTagName); expect(store.state.editNew.release.tagName).toBe(updatedTagName);
}); });
it('shows the "Create from" field', () => { it('shows the "Create from" field', () => {
...@@ -178,7 +178,7 @@ describe('releases/components/tag_field_new', () => { ...@@ -178,7 +178,7 @@ describe('releases/components/tag_field_new', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(store.state.detail.createFrom).toBe(updatedCreateFrom); expect(store.state.editNew.createFrom).toBe(updatedCreateFrom);
}); });
}); });
}); });
......
...@@ -3,7 +3,7 @@ import TagField from '~/releases/components/tag_field.vue'; ...@@ -3,7 +3,7 @@ import TagField from '~/releases/components/tag_field.vue';
import TagFieldExisting from '~/releases/components/tag_field_existing.vue'; import TagFieldExisting from '~/releases/components/tag_field_existing.vue';
import TagFieldNew from '~/releases/components/tag_field_new.vue'; import TagFieldNew from '~/releases/components/tag_field_new.vue';
import createStore from '~/releases/stores'; import createStore from '~/releases/stores';
import createDetailModule from '~/releases/stores/modules/detail'; import createEditNewModule from '~/releases/stores/modules/edit_new';
describe('releases/components/tag_field', () => { describe('releases/components/tag_field', () => {
let store; let store;
...@@ -12,11 +12,11 @@ describe('releases/components/tag_field', () => { ...@@ -12,11 +12,11 @@ describe('releases/components/tag_field', () => {
const createComponent = ({ tagName }) => { const createComponent = ({ tagName }) => {
store = createStore({ store = createStore({
modules: { modules: {
detail: createDetailModule({}), editNew: createEditNewModule({}),
}, },
}); });
store.state.detail.tagName = tagName; store.state.editNew.tagName = tagName;
wrapper = shallowMount(TagField, { store }); wrapper = shallowMount(TagField, { store });
}; };
......
...@@ -9,9 +9,9 @@ import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; ...@@ -9,9 +9,9 @@ import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import httpStatus from '~/lib/utils/http_status'; import httpStatus from '~/lib/utils/http_status';
import { redirectTo } from '~/lib/utils/url_utility'; import { redirectTo } from '~/lib/utils/url_utility';
import { ASSET_LINK_TYPE } from '~/releases/constants'; import { ASSET_LINK_TYPE } from '~/releases/constants';
import * as actions from '~/releases/stores/modules/detail/actions'; import * as actions from '~/releases/stores/modules/edit_new/actions';
import * as types from '~/releases/stores/modules/detail/mutation_types'; import * as types from '~/releases/stores/modules/edit_new/mutation_types';
import createState from '~/releases/stores/modules/detail/state'; import createState from '~/releases/stores/modules/edit_new/state';
import { releaseToApiJson, apiJsonToRelease } from '~/releases/util'; import { releaseToApiJson, apiJsonToRelease } from '~/releases/util';
jest.mock('~/flash'); jest.mock('~/flash');
...@@ -23,7 +23,7 @@ jest.mock('~/lib/utils/url_utility', () => ({ ...@@ -23,7 +23,7 @@ jest.mock('~/lib/utils/url_utility', () => ({
const originalRelease = getJSONFixture('api/releases/release.json'); const originalRelease = getJSONFixture('api/releases/release.json');
describe('Release detail actions', () => { describe('Release edit/new actions', () => {
let state; let state;
let release; let release;
let mock; let mock;
......
import * as getters from '~/releases/stores/modules/detail/getters'; import * as getters from '~/releases/stores/modules/edit_new/getters';
describe('Release detail getters', () => { describe('Release edit/new getters', () => {
describe('isExistingRelease', () => { describe('isExistingRelease', () => {
it('returns true if the release is an existing release that already exists in the database', () => { it('returns true if the release is an existing release that already exists in the database', () => {
const state = { tagName: 'test-tag-name' }; const state = { tagName: 'test-tag-name' };
......
import { getJSONFixture } from 'helpers/fixtures'; import { getJSONFixture } from 'helpers/fixtures';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { ASSET_LINK_TYPE, DEFAULT_ASSET_LINK_TYPE } from '~/releases/constants'; import { ASSET_LINK_TYPE, DEFAULT_ASSET_LINK_TYPE } from '~/releases/constants';
import * as types from '~/releases/stores/modules/detail/mutation_types'; import * as types from '~/releases/stores/modules/edit_new/mutation_types';
import mutations from '~/releases/stores/modules/detail/mutations'; import mutations from '~/releases/stores/modules/edit_new/mutations';
import createState from '~/releases/stores/modules/detail/state'; import createState from '~/releases/stores/modules/edit_new/state';
const originalRelease = getJSONFixture('api/releases/release.json'); const originalRelease = getJSONFixture('api/releases/release.json');
describe('Release detail mutations', () => { describe('Release edit/new mutations', () => {
let state; let state;
let release; let release;
......
...@@ -15,9 +15,9 @@ import { ...@@ -15,9 +15,9 @@ import {
fetchReleasesRest, fetchReleasesRest,
receiveReleasesError, receiveReleasesError,
setSorting, setSorting,
} from '~/releases/stores/modules/list/actions'; } from '~/releases/stores/modules/index/actions';
import * as types from '~/releases/stores/modules/list/mutation_types'; import * as types from '~/releases/stores/modules/index/mutation_types';
import createState from '~/releases/stores/modules/list/state'; import createState from '~/releases/stores/modules/index/state';
import { gqClient, convertAllReleasesGraphQLResponse } from '~/releases/util'; import { gqClient, convertAllReleasesGraphQLResponse } from '~/releases/util';
import { pageInfoHeadersWithoutPagination } from '../../../mock_data'; import { pageInfoHeadersWithoutPagination } from '../../../mock_data';
......
import state from '~/releases/stores/modules/list/state'; import state from '~/releases/stores/modules/index/state';
export const resetStore = (store) => { export const resetStore = (store) => {
store.replaceState(state()); store.replaceState(state());
......
import { getJSONFixture } from 'helpers/fixtures'; import { getJSONFixture } from 'helpers/fixtures';
import { parseIntPagination, convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { parseIntPagination, convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import * as types from '~/releases/stores/modules/list/mutation_types'; import * as types from '~/releases/stores/modules/index/mutation_types';
import mutations from '~/releases/stores/modules/list/mutations'; import mutations from '~/releases/stores/modules/index/mutations';
import createState from '~/releases/stores/modules/list/state'; import createState from '~/releases/stores/modules/index/state';
import { convertAllReleasesGraphQLResponse } from '~/releases/util'; import { convertAllReleasesGraphQLResponse } from '~/releases/util';
import { pageInfoHeadersWithoutPagination } from '../../../mock_data'; import { pageInfoHeadersWithoutPagination } from '../../../mock_data';
......
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