forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpath.test.ts
More file actions
33 lines (27 loc) · 834 Bytes
/
path.test.ts
File metadata and controls
33 lines (27 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import * as path from './path';
describe('path', () => {
describe('join', () => {
it('can join paths', () => {
expect(path.join('dir1', 'dir2')).toEqual('dir1/dir2');
});
it('can join absolute paths', () => {
expect(path.join('/dir1', 'dir2')).toEqual('/dir1/dir2');
});
it('can join top paths', () => {
expect(path.join('/dir1', '../dir2')).toEqual('/dir2');
});
it('can join top paths', () => {
expect(path.join('/dir1', '../../dir2')).toEqual('/dir2');
});
it('can join top paths', () => {
expect(path.join('/dir1/dir2/dir3', '../dir4')).toEqual(
'/dir1/dir2/dir4'
);
});
});
describe('dirname', () => {
it('can find the dirname', () => {
expect(path.dirname('test1/test2/file.js')).toEqual('test1/test2');
});
});
});