Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/registry/explorer/stores/mutations_spec.js')
-rw-r--r--spec/frontend/registry/explorer/stores/mutations_spec.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/frontend/registry/explorer/stores/mutations_spec.js b/spec/frontend/registry/explorer/stores/mutations_spec.js
index 029fd23f7ce..43b2ba84218 100644
--- a/spec/frontend/registry/explorer/stores/mutations_spec.js
+++ b/spec/frontend/registry/explorer/stores/mutations_spec.js
@@ -28,14 +28,32 @@ describe('Mutations Registry Explorer Store', () => {
describe('SET_IMAGES_LIST_SUCCESS', () => {
it('should set the images list', () => {
- const images = [1, 2, 3];
- const expectedState = { ...mockState, images };
+ const images = [{ name: 'foo' }, { name: 'bar' }];
+ const defaultStatus = { deleting: false, failedDelete: false };
+ const expectedState = {
+ ...mockState,
+ images: [{ name: 'foo', ...defaultStatus }, { name: 'bar', ...defaultStatus }],
+ };
mutations[types.SET_IMAGES_LIST_SUCCESS](mockState, images);
expect(mockState).toEqual(expectedState);
});
});
+ describe('UPDATE_IMAGE', () => {
+ it('should update an image', () => {
+ mockState.images = [{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }];
+ const payload = { id: 1, name: 'baz' };
+ const expectedState = {
+ ...mockState,
+ images: [payload, { id: 2, name: 'bar' }],
+ };
+ mutations[types.UPDATE_IMAGE](mockState, payload);
+
+ expect(mockState).toEqual(expectedState);
+ });
+ });
+
describe('SET_TAGS_LIST_SUCCESS', () => {
it('should set the tags list', () => {
const tags = [1, 2, 3];