diff options
author | Phil Hughes <me@iamphill.com> | 2017-11-09 13:53:29 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-11-10 19:56:00 +0300 |
commit | dfe0ad2d83fb459a219ae8af9ea9a74647f8fb80 (patch) | |
tree | 7eab60ae2009030dea32d6014e66408fe307fc13 /spec | |
parent | 5c17c097c6cd2166fd6775ec3976a00b77304546 (diff) |
fixed specs
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/repo/stores/actions/file_spec.js | 2 | ||||
-rw-r--r-- | spec/javascripts/repo/stores/mutations/tree_spec.js | 50 |
2 files changed, 13 insertions, 39 deletions
diff --git a/spec/javascripts/repo/stores/actions/file_spec.js b/spec/javascripts/repo/stores/actions/file_spec.js index 7793b2a2a3e..099c0556e71 100644 --- a/spec/javascripts/repo/stores/actions/file_spec.js +++ b/spec/javascripts/repo/stores/actions/file_spec.js @@ -29,7 +29,7 @@ describe('Multi-file store file actions', () => { }); afterEach(() => { - store._actions.getLastCommitData = [oldGetLastCommitData]; // eslint-disable-line + store._actions.getLastCommitData = oldGetLastCommitData; // eslint-disable-line }); it('closes open files', (done) => { diff --git a/spec/javascripts/repo/stores/mutations/tree_spec.js b/spec/javascripts/repo/stores/mutations/tree_spec.js index 623f89ac44c..1c76cfed9c8 100644 --- a/spec/javascripts/repo/stores/mutations/tree_spec.js +++ b/spec/javascripts/repo/stores/mutations/tree_spec.js @@ -24,17 +24,15 @@ describe('Multi-file store tree mutations', () => { }); describe('SET_DIRECTORY_DATA', () => { - const data = { - trees: [{ - name: 'tree', - }], - submodules: [{ - name: 'submodule', - }], - blobs: [{ - name: 'blob', - }], - }; + const data = [{ + name: 'tree', + }, + { + name: 'submodule', + }, + { + name: 'blob', + }]; it('adds directory data', () => { mutations.SET_DIRECTORY_DATA(localState, { @@ -43,33 +41,9 @@ describe('Multi-file store tree mutations', () => { }); expect(localState.tree.length).toBe(3); - expect(localState.tree[0].type).toBe('tree'); - expect(localState.tree[1].type).toBe('submodule'); - expect(localState.tree[2].type).toBe('blob'); - }); - - it('defaults to rootUrl when no parent_tree_url is in data', () => { - localState.endpoints.rootUrl = 'test'; - - mutations.SET_DIRECTORY_DATA(localState, { - data, - tree: localState, - }); - - expect(localState.tree[0].parentTreeUrl).toBe('test'); - }); - - it('uses parent_tree_url from data', () => { - mutations.SET_DIRECTORY_DATA(localState, { - data: { - ...data, - parent_tree_url: 'parent/', - path: 'test', - }, - tree: localState, - }); - - expect(localState.tree[0].parentTreeUrl).toBe('parent/test'); + expect(localState.tree[0].name).toBe('tree'); + expect(localState.tree[1].name).toBe('submodule'); + expect(localState.tree[2].name).toBe('blob'); }); }); |