Skip to content

Commit

Permalink
Fixed expand test
Browse files Browse the repository at this point in the history
  • Loading branch information
cb1kenobi committed Sep 14, 2023
1 parent ee2f19d commit 45d18dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/util/expand.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@ describe('expand', () => {
delete process.env.USERPROFILE;

const p = expand('~/foo');
expect(p).to.equal(isWin ? 'C:\\Users\\username\\foo' : '/Users/username/foo');
expect(p).toEqual(isWin ? 'C:\\Users\\username\\foo' : '/Users/username/foo');
});

it('should resolve the home directory using USERPROFILE', () => {
delete process.env.HOME;
process.env.USERPROFILE = isWin ? 'C:\\Users\\username' : '/Users/username';

const p = expand('~/foo');
expect(p).to.equal(isWin ? 'C:\\Users\\username\\foo' : '/Users/username/foo');
expect(p).toEqual(isWin ? 'C:\\Users\\username\\foo' : '/Users/username/foo');
});

it('should collapse relative segments', () => {
const p = expand('/path/./to/../foo');
expect(p).to.equal(isWin ? 'C:\\path\\foo' : '/path/foo');
expect(p).toEqual(isWin ? 'C:\\path\\foo' : '/path/foo');
});

(isWin ? it : it.skip)('should resolve environment paths (Windows)', () => {
process.env.SystemRoot = 'C:\\WINDOWS';
const p = expand('%SystemRoot%\\foo');
expect(isWin ? p : p.substring(process.cwd().length + 1)).to.equal('C:\\WINDOWS\\foo');
expect(isWin ? p : p.substring(process.cwd().length + 1)).toMatch(/\\WINDOWS\\foo/);
});
});

0 comments on commit 45d18dc

Please sign in to comment.