Skip to content

Commit

Permalink
fix: πŸ› refactor renameSync tests to use tryGetChildNode
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Jul 16, 2019
1 parent 3896de7 commit 8cd782a
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/__tests__/volume/renameSync.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
import { create } from '../util';
import { create, tryGetChildNode } from '../util';

describe('renameSync(fromPath, toPath)', () => {
it('Renames a file', () => {
const vol = create({ '/foo': 'bar' });
expect(
vol.root
.getChild('foo')
.getNode()
.isFile(),
).toBe(true);
expect(tryGetChildNode(vol.root, 'foo').isFile()).toBe(true);
vol.renameSync('/foo', '/baz');
expect(vol.root.getChild('foo')).toBeUndefined();
expect(
vol.root
.getChild('baz')
.getNode()
.isFile(),
).toBe(true);
expect(tryGetChildNode(vol.root, 'baz').isFile()).toBe(true);
expect(vol.readFileSync('/baz', 'utf8')).toBe('bar');
});
it('Rename file two levels deep', () => {
Expand Down

0 comments on commit 8cd782a

Please sign in to comment.