Commit dfe0ad2d authored by Phil Hughes's avatar Phil Hughes

fixed specs

parent 5c17c097
...@@ -29,7 +29,7 @@ describe('Multi-file store file actions', () => { ...@@ -29,7 +29,7 @@ describe('Multi-file store file actions', () => {
}); });
afterEach(() => { afterEach(() => {
store._actions.getLastCommitData = [oldGetLastCommitData]; // eslint-disable-line store._actions.getLastCommitData = oldGetLastCommitData; // eslint-disable-line
}); });
it('closes open files', (done) => { it('closes open files', (done) => {
......
...@@ -24,17 +24,15 @@ describe('Multi-file store tree mutations', () => { ...@@ -24,17 +24,15 @@ describe('Multi-file store tree mutations', () => {
}); });
describe('SET_DIRECTORY_DATA', () => { describe('SET_DIRECTORY_DATA', () => {
const data = { const data = [{
trees: [{ name: 'tree',
name: 'tree', },
}], {
submodules: [{ name: 'submodule',
name: 'submodule', },
}], {
blobs: [{ name: 'blob',
name: 'blob', }];
}],
};
it('adds directory data', () => { it('adds directory data', () => {
mutations.SET_DIRECTORY_DATA(localState, { mutations.SET_DIRECTORY_DATA(localState, {
...@@ -43,33 +41,9 @@ describe('Multi-file store tree mutations', () => { ...@@ -43,33 +41,9 @@ describe('Multi-file store tree mutations', () => {
}); });
expect(localState.tree.length).toBe(3); expect(localState.tree.length).toBe(3);
expect(localState.tree[0].type).toBe('tree'); expect(localState.tree[0].name).toBe('tree');
expect(localState.tree[1].type).toBe('submodule'); expect(localState.tree[1].name).toBe('submodule');
expect(localState.tree[2].type).toBe('blob'); expect(localState.tree[2].name).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');
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment