summaryrefslogtreecommitdiff
path: root/spec/javascripts/repo/stores
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-11-24 15:54:54 +0000
committerPhil Hughes <me@iamphill.com>2017-11-24 15:55:08 +0000
commite9c7015203cc6454db51021518a91315532e8d30 (patch)
treead13bb16a0a7677d9f5a1aff7b1394b55943394f /spec/javascripts/repo/stores
parent8f7ec95b86fb1b3c84ad8ff3de1f0eb35a93f972 (diff)
downloadgitlab-ce-e9c7015203cc6454db51021518a91315532e8d30.tar.gz
added getter specs
Diffstat (limited to 'spec/javascripts/repo/stores')
-rw-r--r--spec/javascripts/repo/stores/getters_spec.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/javascripts/repo/stores/getters_spec.js b/spec/javascripts/repo/stores/getters_spec.js
index a204b2386cd..952b8ec3a59 100644
--- a/spec/javascripts/repo/stores/getters_spec.js
+++ b/spec/javascripts/repo/stores/getters_spec.js
@@ -116,4 +116,31 @@ describe('Multi-file store getters', () => {
expect(getters.canEditFile(localState)).toBeFalsy();
});
});
+
+ describe('modifiedFiles', () => {
+ it('returns a list of modified files', () => {
+ localState.openFiles.push(file());
+ localState.openFiles.push(file('changed'));
+ localState.openFiles[1].changed = true;
+
+ const modifiedFiles = getters.modifiedFiles(localState);
+
+ expect(modifiedFiles.length).toBe(1);
+ expect(modifiedFiles[0].name).toBe('changed');
+ });
+ });
+
+ describe('addedFiles', () => {
+ it('returns a list of added files', () => {
+ localState.openFiles.push(file());
+ localState.openFiles.push(file('added'));
+ localState.openFiles[1].changed = true;
+ localState.openFiles[1].tempFile = true;
+
+ const modifiedFiles = getters.addedFiles(localState);
+
+ expect(modifiedFiles.length).toBe(1);
+ expect(modifiedFiles[0].name).toBe('added');
+ });
+ });
});