diff options
author | Phil Hughes <me@iamphill.com> | 2018-04-13 11:08:03 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-04-16 09:49:02 +0100 |
commit | 4a22a97e7899db2a35dd6bd0591b82feaa2d58b9 (patch) | |
tree | fa1b281509d9da526cc0dfcce25e9ea9f9493cba /spec/javascripts/ide/stores/getters_spec.js | |
parent | a35391c977b7cfcd63ba5c9d110794608485bafd (diff) | |
download | gitlab-ce-4a22a97e7899db2a35dd6bd0591b82feaa2d58b9.tar.gz |
added specs to stores allBlobs getter
Diffstat (limited to 'spec/javascripts/ide/stores/getters_spec.js')
-rw-r--r-- | spec/javascripts/ide/stores/getters_spec.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/javascripts/ide/stores/getters_spec.js b/spec/javascripts/ide/stores/getters_spec.js index 33733b97dff..4a7d9a05402 100644 --- a/spec/javascripts/ide/stores/getters_spec.js +++ b/spec/javascripts/ide/stores/getters_spec.js @@ -72,4 +72,24 @@ describe('IDE store getters', () => { expect(getters.currentMergeRequest(localState)).toBeNull(); }); }); + + describe('allBlobs', () => { + beforeEach(() => { + Object.assign(localState.entries, { + index: { type: 'blob', name: 'index', lastOpenedAt: 0 }, + app: { type: 'blob', name: 'blob', lastOpenedAt: 0 }, + folder: { type: 'folder', name: 'folder', lastOpenedAt: 0 }, + }); + }); + + it('returns only blobs', () => { + expect(getters.allBlobs(localState).length).toBe(2); + }); + + it('returns list sorted by lastOpenedAt', () => { + localState.entries.app.lastOpenedAt = new Date().getTime(); + + expect(getters.allBlobs(localState)[0].name).toBe('blob'); + }); + }); }); |