Commit 90b9d07f authored by Phil Hughes's avatar Phil Hughes

more specs

typo fix 🙈
parent 7a73d29e
...@@ -163,10 +163,10 @@ export const createOrMergeEntry = ({ projectId, ...@@ -163,10 +163,10 @@ export const createOrMergeEntry = ({ projectId,
level, level,
state }) => { state }) => {
if (state.changedFiles.length) { if (state.changedFiles.length) {
const foundChangedFileFile = findEntry(state.changedFiles, type, entry.name); const foundChangedFile = findEntry(state.changedFiles, type, entry.name);
if (foundChangedFileFile) { if (foundChangedFile) {
return foundChangedFileFile; return foundChangedFile;
} }
} }
......
...@@ -370,5 +370,61 @@ describe('Multi-file store tree actions', () => { ...@@ -370,5 +370,61 @@ describe('Multi-file store tree actions', () => {
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('adds changed state of an already existing file', (done) => {
const f = file('changedFile');
const tree = {
tree: [],
};
const data = {
trees: [{ name: 'tree' }],
submodules: [{ name: 'submodule' }],
blobs: [f],
};
store.state.changedFiles.push({
...f,
type: 'blob',
changed: true,
});
store.dispatch('updateDirectoryData', {
data,
tree,
clearTree: false,
}).then(() => {
expect(tree.tree[2].changed).toBeTruthy();
done();
}).catch(done.fail);
});
it('adds opened state of an already existing file', (done) => {
const f = file('openedFile');
const tree = {
tree: [],
};
const data = {
trees: [{ name: 'tree' }],
submodules: [{ name: 'submodule' }],
blobs: [f],
};
store.state.openFiles.push({
...f,
type: 'blob',
opened: true,
});
store.dispatch('updateDirectoryData', {
data,
tree,
clearTree: false,
}).then(() => {
expect(tree.tree[2].opened).toBeTruthy();
done();
}).catch(done.fail);
});
}); });
}); });
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