Skip to content

Commit

Permalink
Use assert.equal for path tests
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Nov 24, 2024
1 parent f3c9b67 commit 33ac3b0
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/path.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ import { basename, dirname, extname, join, normalize, resolve } from '../src/emu

suite('Path emulation', () => {
test('resolve', () => {
assert(resolve('somepath') === '/somepath');
assert(resolve('/another', 'path') === '/another/path');
assert.equal(resolve('somepath'), '/somepath');
assert.equal(resolve('/another', 'path'), '/another/path');
});

test('join', () => {
assert(join('/path', 'to', 'file.txt') === '/path/to/file.txt');
assert(join('/path/', 'to', '/file.txt') === '/path/to/file.txt');
assert.equal(join('/path', 'to', 'file.txt'), '/path/to/file.txt');
assert.equal(join('/path/', 'to', '/file.txt'), '/path/to/file.txt');
});

test('normalize', () => {
assert(normalize('/path/to/../file.txt') === '/path/file.txt');
assert(normalize('/path/to/./file.txt') === '/path/to/file.txt');
assert.equal(normalize('/path/to/../file.txt'), '/path/file.txt');
assert.equal(normalize('/path/to/./file.txt'), '/path/to/file.txt');
});

test('basename', () => {
assert(basename('/path/to/file.txt') === 'file.txt');
assert(basename('/path/to/file.txt', '.txt') === 'file');
assert.equal(basename('/path/to/file.txt'), 'file.txt');
assert.equal(basename('/path/to/file.txt', '.txt'), 'file');
});

test('dirname', () => {
assert(dirname('/path/to/file.txt') === '/path/to');
assert.equal(dirname('/path/to/file.txt'), '/path/to');
});

test('extname', () => {
assert(extname('/path/to/file.txt') === '.txt');
assert(extname('/path/to/file') === '');
assert.equal(extname('/path/to/file.txt'), '.txt');
assert.equal(extname('/path/to/file'), '');
});
});

0 comments on commit 33ac3b0

Please sign in to comment.