summaryrefslogtreecommitdiff
path: root/spec/javascripts/ide/stores/getters_spec.js
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-05-04 13:36:50 +0100
committerPhil Hughes <me@iamphill.com>2018-05-04 13:36:50 +0100
commitd9f3af500c1c3135a63014904459e5a4ab6bc395 (patch)
tree14ca96edbc8517d68c275b1501f4ae858e64d642 /spec/javascripts/ide/stores/getters_spec.js
parentfa8d70a989f548f55be44ae47fab0f6f68a480c8 (diff)
parent2d23cb1b9fa9fed19ce66998c5b4177ee13ef5f3 (diff)
downloadgitlab-ce-d9f3af500c1c3135a63014904459e5a4ab6bc395.tar.gz
Merge branch 'master' into 44846-improve-web-ide-left-panel-and-modes
Diffstat (limited to 'spec/javascripts/ide/stores/getters_spec.js')
-rw-r--r--spec/javascripts/ide/stores/getters_spec.js63
1 files changed, 63 insertions, 0 deletions
diff --git a/spec/javascripts/ide/stores/getters_spec.js b/spec/javascripts/ide/stores/getters_spec.js
index 68e0cceef76..67a848e8edd 100644
--- a/spec/javascripts/ide/stores/getters_spec.js
+++ b/spec/javascripts/ide/stores/getters_spec.js
@@ -78,4 +78,67 @@ describe('IDE store getters', () => {
expect(getters.allBlobs(localState)[0].name).toBe('blob');
});
});
+
+ describe('getChangesInFolder', () => {
+ it('returns length of changed files for a path', () => {
+ localState.changedFiles.push(
+ {
+ path: 'test/index',
+ name: 'index',
+ },
+ {
+ path: 'app/123',
+ name: '123',
+ },
+ );
+
+ expect(getters.getChangesInFolder(localState)('test')).toBe(1);
+ });
+
+ it('returns length of changed & staged files for a path', () => {
+ localState.changedFiles.push(
+ {
+ path: 'test/index',
+ name: 'index',
+ },
+ {
+ path: 'testing/123',
+ name: '123',
+ },
+ );
+
+ localState.stagedFiles.push(
+ {
+ path: 'test/123',
+ name: '123',
+ },
+ {
+ path: 'test/index',
+ name: 'index',
+ },
+ {
+ path: 'testing/12345',
+ name: '12345',
+ },
+ );
+
+ expect(getters.getChangesInFolder(localState)('test')).toBe(2);
+ });
+
+ it('returns length of changed & tempFiles files for a path', () => {
+ localState.changedFiles.push(
+ {
+ path: 'test/index',
+ name: 'index',
+ },
+ {
+ path: 'test/newfile',
+ name: 'newfile',
+ tempFile: true,
+ },
+ );
+
+ expect(getters.getChangesInFolder(localState)('test')).toBe(2);
+ });
+ });
});