diff options
| author | stonedDiscord <Tukz@gmx.de> | 2025-06-26 18:43:10 +0200 |
|---|---|---|
| committer | stonedDiscord <Tukz@gmx.de> | 2025-06-26 18:43:10 +0200 |
| commit | 7effd0f458663f5af821fb96b0dd23ef32b43e43 (patch) | |
| tree | 6fcd18de1ab9129758d1bbb08aa8cde034da6435 /webAO/__tests__ | |
| parent | a20cbff15582b0447c82d95fa0237248c4263e59 (diff) | |
simplest test
Diffstat (limited to 'webAO/__tests__')
| -rw-r--r-- | webAO/__tests__/paths.test.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/webAO/__tests__/paths.test.ts b/webAO/__tests__/paths.test.ts new file mode 100644 index 0000000..fa1a2d0 --- /dev/null +++ b/webAO/__tests__/paths.test.ts @@ -0,0 +1,31 @@ +import { getFilenameFromPath } from '../utils/paths'; + +// Test Case 1: Valid Path with Filename +test('should return the filename for a valid path', () => { + const result = getFilenameFromPath('/path/to/file.txt'); + expect(result).toBe('file.txt'); +}); + +// Test Case 2: Path without File Extension +test('should handle paths without file extension', () => { + const result = getFilenameFromPath('/path/to/file'); + expect(result).toBe('file'); +}); + +// Test Case 3: Empty String +test('should return an empty string if input is empty', () => { + const result = getFilenameFromPath(''); + expect(result).toBe(''); +}); + +// Test Case 4: Path with Multiple Slashes +test('should handle paths with multiple consecutive slashes', () => { + const result = getFilenameFromPath('//path//to///file.txt'); + expect(result).toBe('file.txt'); +}); + +// Test Case 5: No Filename in Path +test('should return an empty string if there is no filename in the path', () => { + const result = getFilenameFromPath('/path/to/'); + expect(result).toBe(''); +}); |
