diff options
author | Paul Slaughter <pslaughter@gitlab.com> | 2019-04-24 03:45:03 -0500 |
---|---|---|
committer | Paul Slaughter <pslaughter@gitlab.com> | 2019-04-24 03:45:03 -0500 |
commit | 218430bdde361a13f274beb558c5fd30b564b6c6 (patch) | |
tree | 4cb1741eb29732379969a8a0269c03c4c4314316 /spec/javascripts | |
parent | 4518806c9ca89f0403bfe92286c496cd12cd9393 (diff) | |
download | gitlab-ce-218430bdde361a13f274beb558c5fd30b564b6c6.tar.gz |
Create constants for IDE commit action values
**Why?**
These values will be used to help build the mirroring diff.
It is helpful keeping it controlled in a constant.
**Links:**
- https://gitlab.com/gitlab-org/gitlab-ee/issues/10232
- https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/11478
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/ide/stores/modules/commit/actions_spec.js | 5 | ||||
-rw-r--r-- | spec/javascripts/ide/stores/utils_spec.js | 19 |
2 files changed, 13 insertions, 11 deletions
diff --git a/spec/javascripts/ide/stores/modules/commit/actions_spec.js b/spec/javascripts/ide/stores/modules/commit/actions_spec.js index abc97f3072c..cdeb9b4b896 100644 --- a/spec/javascripts/ide/stores/modules/commit/actions_spec.js +++ b/spec/javascripts/ide/stores/modules/commit/actions_spec.js @@ -4,6 +4,7 @@ import service from '~/ide/services'; import router from '~/ide/ide_router'; import eventHub from '~/ide/eventhub'; import consts from '~/ide/stores/modules/commit/constants'; +import { commitActionTypes } from '~/ide/constants'; import { resetStore, file } from 'spec/ide/helpers'; describe('IDE commit module actions', () => { @@ -294,7 +295,7 @@ describe('IDE commit module actions', () => { commit_message: 'testing 123', actions: [ { - action: 'update', + action: commitActionTypes.update, file_path: jasmine.anything(), content: undefined, encoding: jasmine.anything(), @@ -321,7 +322,7 @@ describe('IDE commit module actions', () => { commit_message: 'testing 123', actions: [ { - action: 'update', + action: commitActionTypes.update, file_path: jasmine.anything(), content: undefined, encoding: jasmine.anything(), diff --git a/spec/javascripts/ide/stores/utils_spec.js b/spec/javascripts/ide/stores/utils_spec.js index c4f122efdda..debe1c4acee 100644 --- a/spec/javascripts/ide/stores/utils_spec.js +++ b/spec/javascripts/ide/stores/utils_spec.js @@ -1,4 +1,5 @@ import * as utils from '~/ide/stores/utils'; +import { commitActionTypes } from '~/ide/constants'; import { file } from '../helpers'; describe('Multi-file store utils', () => { @@ -107,7 +108,7 @@ describe('Multi-file store utils', () => { commit_message: 'commit message', actions: [ { - action: 'update', + action: commitActionTypes.update, file_path: 'staged', content: 'updated file content', encoding: 'text', @@ -115,7 +116,7 @@ describe('Multi-file store utils', () => { previous_path: undefined, }, { - action: 'create', + action: commitActionTypes.create, file_path: 'added', content: 'new file content', encoding: 'base64', @@ -123,7 +124,7 @@ describe('Multi-file store utils', () => { previous_path: undefined, }, { - action: 'delete', + action: commitActionTypes.delete, file_path: 'deletedFile', content: undefined, encoding: 'text', @@ -170,7 +171,7 @@ describe('Multi-file store utils', () => { commit_message: 'prebuilt test commit message', actions: [ { - action: 'update', + action: commitActionTypes.update, file_path: 'staged', content: 'updated file content', encoding: 'text', @@ -178,7 +179,7 @@ describe('Multi-file store utils', () => { previous_path: undefined, }, { - action: 'create', + action: commitActionTypes.create, file_path: 'added', content: 'new file content', encoding: 'base64', @@ -193,19 +194,19 @@ describe('Multi-file store utils', () => { describe('commitActionForFile', () => { it('returns deleted for deleted file', () => { - expect(utils.commitActionForFile({ deleted: true })).toBe('delete'); + expect(utils.commitActionForFile({ deleted: true })).toBe(commitActionTypes.delete); }); it('returns create for tempFile', () => { - expect(utils.commitActionForFile({ tempFile: true })).toBe('create'); + expect(utils.commitActionForFile({ tempFile: true })).toBe(commitActionTypes.create); }); it('returns move for moved file', () => { - expect(utils.commitActionForFile({ prevPath: 'test' })).toBe('move'); + expect(utils.commitActionForFile({ prevPath: 'test' })).toBe(commitActionTypes.move); }); it('returns update by default', () => { - expect(utils.commitActionForFile({})).toBe('update'); + expect(utils.commitActionForFile({})).toBe(commitActionTypes.update); }); }); |