diff options
Diffstat (limited to 'spec/frontend/ide/stores')
-rw-r--r-- | spec/frontend/ide/stores/actions/file_spec.js | 8 | ||||
-rw-r--r-- | spec/frontend/ide/stores/actions/tree_spec.js | 2 | ||||
-rw-r--r-- | spec/frontend/ide/stores/getters_spec.js | 6 | ||||
-rw-r--r-- | spec/frontend/ide/stores/modules/commit/getters_spec.js | 38 | ||||
-rw-r--r-- | spec/frontend/ide/stores/mutations/file_spec.js | 20 | ||||
-rw-r--r-- | spec/frontend/ide/stores/mutations/merge_request_spec.js | 2 |
6 files changed, 36 insertions, 40 deletions
diff --git a/spec/frontend/ide/stores/actions/file_spec.js b/spec/frontend/ide/stores/actions/file_spec.js index 6c1dee1e5ca..d1c31cd412b 100644 --- a/spec/frontend/ide/stores/actions/file_spec.js +++ b/spec/frontend/ide/stores/actions/file_spec.js @@ -60,8 +60,8 @@ describe('IDE store file actions', () => { it('closes open files', () => { return store.dispatch('closeFile', localFile).then(() => { - expect(localFile.opened).toBeFalsy(); - expect(localFile.active).toBeFalsy(); + expect(localFile.opened).toBe(false); + expect(localFile.active).toBe(false); expect(store.state.openFiles.length).toBe(0); }); }); @@ -269,7 +269,7 @@ describe('IDE store file actions', () => { it('sets the file as active', () => { return store.dispatch('getFileData', { path: localFile.path }).then(() => { - expect(localFile.active).toBeTruthy(); + expect(localFile.active).toBe(true); }); }); @@ -277,7 +277,7 @@ describe('IDE store file actions', () => { return store .dispatch('getFileData', { path: localFile.path, makeFileActive: false }) .then(() => { - expect(localFile.active).toBeFalsy(); + expect(localFile.active).toBe(false); }); }); diff --git a/spec/frontend/ide/stores/actions/tree_spec.js b/spec/frontend/ide/stores/actions/tree_spec.js index d43393875eb..6e8a03b47ad 100644 --- a/spec/frontend/ide/stores/actions/tree_spec.js +++ b/spec/frontend/ide/stores/actions/tree_spec.js @@ -134,7 +134,7 @@ describe('Multi-file store tree actions', () => { it('toggles the tree open', async () => { await store.dispatch('toggleTreeOpen', tree.path); - expect(tree.opened).toBeTruthy(); + expect(tree.opened).toBe(true); }); }); diff --git a/spec/frontend/ide/stores/getters_spec.js b/spec/frontend/ide/stores/getters_spec.js index 53d161ae5c9..24661e21cd0 100644 --- a/spec/frontend/ide/stores/getters_spec.js +++ b/spec/frontend/ide/stores/getters_spec.js @@ -268,7 +268,7 @@ describe('IDE store getters', () => { currentProject: undefined, }; - expect(getters.isOnDefaultBranch({}, localGetters)).toBeFalsy(); + expect(getters.isOnDefaultBranch({}, localGetters)).toBe(undefined); }); it("returns true when project's default branch matches current branch", () => { @@ -279,7 +279,7 @@ describe('IDE store getters', () => { branchName: 'main', }; - expect(getters.isOnDefaultBranch({}, localGetters)).toBeTruthy(); + expect(getters.isOnDefaultBranch({}, localGetters)).toBe(true); }); it("returns false when project's default branch doesn't match current branch", () => { @@ -290,7 +290,7 @@ describe('IDE store getters', () => { branchName: 'feature', }; - expect(getters.isOnDefaultBranch({}, localGetters)).toBeFalsy(); + expect(getters.isOnDefaultBranch({}, localGetters)).toBe(false); }); }); diff --git a/spec/frontend/ide/stores/modules/commit/getters_spec.js b/spec/frontend/ide/stores/modules/commit/getters_spec.js index 1e34087b290..38ebe36c2c5 100644 --- a/spec/frontend/ide/stores/modules/commit/getters_spec.js +++ b/spec/frontend/ide/stores/modules/commit/getters_spec.js @@ -14,21 +14,21 @@ describe('IDE commit module getters', () => { describe('discardDraftButtonDisabled', () => { it('returns true when commitMessage is empty', () => { - expect(getters.discardDraftButtonDisabled(state)).toBeTruthy(); + expect(getters.discardDraftButtonDisabled(state)).toBe(true); }); it('returns false when commitMessage is not empty & loading is false', () => { state.commitMessage = 'test'; state.submitCommitLoading = false; - expect(getters.discardDraftButtonDisabled(state)).toBeFalsy(); + expect(getters.discardDraftButtonDisabled(state)).toBe(false); }); it('returns true when commitMessage is not empty & loading is true', () => { state.commitMessage = 'test'; state.submitCommitLoading = true; - expect(getters.discardDraftButtonDisabled(state)).toBeTruthy(); + expect(getters.discardDraftButtonDisabled(state)).toBe(true); }); }); @@ -152,13 +152,13 @@ describe('IDE commit module getters', () => { it('returns false if NOT creating a new branch', () => { state.commitAction = COMMIT_TO_CURRENT_BRANCH; - expect(getters.isCreatingNewBranch(state)).toBeFalsy(); + expect(getters.isCreatingNewBranch(state)).toBe(false); }); it('returns true if creating a new branch', () => { state.commitAction = COMMIT_TO_NEW_BRANCH; - expect(getters.isCreatingNewBranch(state)).toBeTruthy(); + expect(getters.isCreatingNewBranch(state)).toBe(true); }); }); @@ -183,7 +183,7 @@ describe('IDE commit module getters', () => { }); it('should never hide "New MR" option', () => { - expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBeFalsy(); + expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBeNull(); }); }); @@ -195,13 +195,13 @@ describe('IDE commit module getters', () => { it('should NOT hide "New MR" option if user can NOT push to the current branch', () => { rootGetters.canPushToBranch = false; - expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBeFalsy(); + expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBe(false); }); it('should hide "New MR" option if user can push to the current branch', () => { rootGetters.canPushToBranch = true; - expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBeTruthy(); + expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBe(true); }); }); @@ -211,7 +211,7 @@ describe('IDE commit module getters', () => { }); it('should never hide "New MR" option', () => { - expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBeFalsy(); + expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBeNull(); }); }); @@ -223,13 +223,13 @@ describe('IDE commit module getters', () => { it('should NOT hide "New MR" option if there is NO existing MR for the current branch', () => { rootGetters.hasMergeRequest = false; - expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBeFalsy(); + expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBeNull(); }); it('should hide "New MR" option if there is existing MR for the current branch', () => { rootGetters.hasMergeRequest = true; - expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBeTruthy(); + expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBe(true); }); }); @@ -247,17 +247,13 @@ describe('IDE commit module getters', () => { it('should hide "New MR" when there is an existing MR', () => { rootGetters.hasMergeRequest = true; - expect( - getters.shouldHideNewMrOption(state, localGetters, null, rootGetters), - ).toBeTruthy(); + expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBe(true); }); it('should hide "New MR" when there is no existing MR', () => { rootGetters.hasMergeRequest = false; - expect( - getters.shouldHideNewMrOption(state, localGetters, null, rootGetters), - ).toBeTruthy(); + expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBe(true); }); }); @@ -270,17 +266,17 @@ describe('IDE commit module getters', () => { rootGetters.hasMergeRequest = false; rootGetters.canPushToBranch = true; - expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBeFalsy(); + expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBe(false); rootGetters.hasMergeRequest = true; rootGetters.canPushToBranch = true; - expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBeFalsy(); + expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBe(false); rootGetters.hasMergeRequest = false; rootGetters.canPushToBranch = false; - expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBeFalsy(); + expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBe(false); }); }); }); @@ -292,7 +288,7 @@ describe('IDE commit module getters', () => { rootGetters.hasMergeRequest = true; rootGetters.canPushToBranch = true; - expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBeFalsy(); + expect(getters.shouldHideNewMrOption(state, localGetters, null, rootGetters)).toBe(false); }); }); diff --git a/spec/frontend/ide/stores/mutations/file_spec.js b/spec/frontend/ide/stores/mutations/file_spec.js index 1453f26c1d9..69ec2e7a6f5 100644 --- a/spec/frontend/ide/stores/mutations/file_spec.js +++ b/spec/frontend/ide/stores/mutations/file_spec.js @@ -22,7 +22,7 @@ describe('IDE store file mutations', () => { active: true, }); - expect(localFile.active).toBeTruthy(); + expect(localFile.active).toBe(true); }); it('sets pending tab as not active', () => { @@ -41,7 +41,7 @@ describe('IDE store file mutations', () => { it('adds into opened files', () => { mutations.TOGGLE_FILE_OPEN(localState, localFile.path); - expect(localFile.opened).toBeTruthy(); + expect(localFile.opened).toBe(true); expect(localState.openFiles.length).toBe(1); }); @@ -50,7 +50,7 @@ describe('IDE store file mutations', () => { mutations.TOGGLE_FILE_OPEN(localState, localFile.path); mutations.TOGGLE_FILE_OPEN(localState, localFile.path); - expect(localFile.opened).toBeFalsy(); + expect(localFile.opened).toBe(false); expect(localState.openFiles.length).toBe(0); }); }); @@ -162,7 +162,7 @@ describe('IDE store file mutations', () => { callMutationForFile(localFile); - expect(localFile.raw).toBeFalsy(); + expect(localFile.raw).toEqual(''); expect(localState.stagedFiles[0].raw).toBe('testing'); }); @@ -172,7 +172,7 @@ describe('IDE store file mutations', () => { callMutationForFile(localFile); - expect(localFile.raw).toBeFalsy(); + expect(localFile.raw).toEqual(''); expect(localFile.content).toBe('testing'); }); @@ -202,7 +202,7 @@ describe('IDE store file mutations', () => { callMutationForFile(localFile); - expect(localFile.raw).toBeFalsy(); + expect(localFile.raw).toEqual(''); expect(localState.stagedFiles[0].raw).toBe('testing'); }); }); @@ -239,7 +239,7 @@ describe('IDE store file mutations', () => { }); expect(localFile.content).toBe('testing'); - expect(localFile.changed).toBeTruthy(); + expect(localFile.changed).toBe(true); }); it('sets changed if file is a temp file', () => { @@ -250,7 +250,7 @@ describe('IDE store file mutations', () => { content: '', }); - expect(localFile.changed).toBeTruthy(); + expect(localFile.changed).toBe(true); }); }); @@ -329,7 +329,7 @@ describe('IDE store file mutations', () => { mutations.DISCARD_FILE_CHANGES(localState, localFile.path); expect(localFile.content).toBe(''); - expect(localFile.changed).toBeFalsy(); + expect(localFile.changed).toBe(false); }); it('adds to root tree if deleted', () => { @@ -527,7 +527,7 @@ describe('IDE store file mutations', () => { changed: true, }); - expect(localFile.changed).toBeTruthy(); + expect(localFile.changed).toBe(true); }); }); diff --git a/spec/frontend/ide/stores/mutations/merge_request_spec.js b/spec/frontend/ide/stores/mutations/merge_request_spec.js index afbe6770c0d..2af06835181 100644 --- a/spec/frontend/ide/stores/mutations/merge_request_spec.js +++ b/spec/frontend/ide/stores/mutations/merge_request_spec.js @@ -30,7 +30,7 @@ describe('IDE store merge request mutations', () => { const newMr = localState.projects.abcproject.mergeRequests[1]; expect(newMr.title).toBe('mr'); - expect(newMr.active).toBeTruthy(); + expect(newMr.active).toBe(true); }); it('keeps original data', () => { |