fix(backend-test): delete nested file path (#2930)

This commit is contained in:
Bartholomew
2019-11-29 17:10:39 +01:00
committed by Erez Rokah
parent 45a6ee92cc
commit b0fba6dc9a
2 changed files with 46 additions and 4 deletions

View File

@ -157,4 +157,48 @@ describe('test backend implementation', () => {
});
});
});
describe('deleteFile', () => {
it('should delete entry by path', async () => {
window.repoFiles = {
posts: {
'some-post.md': {
content: 'post content',
},
},
};
const backend = new TestBackend();
await backend.deleteFile('posts/some-post.md');
expect(window.repoFiles).toEqual({
posts: {},
});
});
it('should delete entry by nested path', async () => {
window.repoFiles = {
posts: {
dir1: {
dir2: {
'some-post.md': {
content: 'post content',
},
},
},
},
};
const backend = new TestBackend();
await backend.deleteFile('posts/dir1/dir2/some-post.md');
expect(window.repoFiles).toEqual({
posts: {
dir1: {
dir2: {},
},
},
});
});
});
});