-
Notifications
You must be signed in to change notification settings - Fork 748
[Bug] - Incorrectly handled absolute paths #1064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
1a256cb
2c756cf
eb41e1a
b64e8c2
044fc37
be81cb7
c7dfb53
aaf2d1c
5d3aed1
2a98000
bc2cc16
ba5213f
7945dcd
e917560
3542b2e
91b18be
3a3cf70
ee21f6c
435ec35
357a65b
3ea8d7c
fe1a9f5
abd00bd
739edf7
751dbcc
c707e7d
451105a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { expect, test, describe } from 'vitest' | ||
| import { rewriteSrc } from '../../../src/template/utils' | ||
|
|
||
| describe('rewriteSrc', () => { | ||
| test('should return basename for parent directory paths', () => { | ||
| expect(rewriteSrc('../file.txt')).toBe('file.txt') | ||
| expect(rewriteSrc('../../config.json')).toBe('config.json') | ||
| expect(rewriteSrc('../dir/file.py')).toBe('file.py') | ||
| }) | ||
|
|
||
| test('should preserve relative paths', () => { | ||
| expect(rewriteSrc('file.txt')).toBe('file.txt') | ||
| expect(rewriteSrc('dir/file.txt')).toBe('dir/file.txt') | ||
| expect(rewriteSrc('./file.txt')).toBe('./file.txt') | ||
| expect(rewriteSrc('src/components/Button.tsx')).toBe( | ||
| 'src/components/Button.tsx' | ||
| ) | ||
| }) | ||
|
|
||
| test('should preserve absolute paths', () => { | ||
| expect(rewriteSrc('/usr/local/file.txt')).toBe('/usr/local/file.txt') | ||
|
Check failure on line 21 in packages/js-sdk/tests/template/utils/rewriteSrc.test.ts
|
||
| expect(rewriteSrc('/home/user/project/file.py')).toBe( | ||
| '/home/user/project/file.py' | ||
| ) | ||
| }) | ||
|
|
||
| test('should handle glob patterns', () => { | ||
| expect(rewriteSrc('*.txt')).toBe('*.txt') | ||
| expect(rewriteSrc('**/*.py')).toBe('**/*.py') | ||
| expect(rewriteSrc('../*.txt')).toBe('*.txt') | ||
| }) | ||
| }) | ||
Uh oh!
There was an error while loading. Please reload this page.