-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests and change formatPath to always format from win32
- Loading branch information
Cristiano Belloni
committed
Jul 5, 2022
1 parent
8fd1e0d
commit 799b789
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
packages/modular-scripts/src/__tests__/utils/formatPath.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { normalizeToPosix } from '../../esbuild-scripts/utils/formatPath'; | ||
|
||
describe('Normalize path to Posix', () => { | ||
it('should convert a Win32 path into a Posix path', () => { | ||
expect(normalizeToPosix('\\this\\is\\my\\win32\\path')).toBe( | ||
'/this/is/my/win32/path', | ||
); | ||
}); | ||
it('should convert a mixed path into a Posix path', () => { | ||
expect(normalizeToPosix('/this/is\\my/mixed\\path')).toBe( | ||
'/this/is/my/mixed/path', | ||
); | ||
}); | ||
it('should leave a Posix path untouched', () => { | ||
expect(normalizeToPosix('/this/is/my/posix/path')).toBe( | ||
'/this/is/my/posix/path', | ||
); | ||
}); | ||
it('should return undefined if undefined is passed', () => { | ||
expect(normalizeToPosix(undefined)).toBeUndefined(); | ||
}); | ||
it('should convert a relative path to a relative Posix path', () => { | ||
expect(normalizeToPosix('this\\is/my/relative\\mixed/path')).toBe( | ||
'this/is/my/relative/mixed/path', | ||
); | ||
}); | ||
}); |