* Separate "p4" and "packager" * Continue p4, packager, common refactoring * Plist does not need to be a class * Document what the `common` folder is for * Fix typo in "uril-utils" * Move more p4 JS to the p4 folder * Move everything from packager/lib to just packager * Fix imports in tests
18 lines
692 B
JavaScript
18 lines
692 B
JavaScript
import {extractProjectId, getTitleFromURL, isValidURL} from '../../src/p4/url-utils';
|
|
|
|
test('extractProjectId', () => {
|
|
expect(extractProjectId('https://scratch.mit.edu/projects/104')).toBe('104');
|
|
});
|
|
|
|
test('getTitleFromURL', () => {
|
|
expect(getTitleFromURL('https://example.github.io/path/Mario.sb3')).toBe('Mario');
|
|
expect(getTitleFromURL('https://example.github.io/path/Mario.sb')).toBe('Mario');
|
|
expect(getTitleFromURL('https://example.github.io/path/Mario.sb2')).toBe('Mario');
|
|
});
|
|
|
|
test('isValidURL', () => {
|
|
expect(isValidURL('https://example.github.io')).toBe(true);
|
|
expect(isValidURL('file:///etc/passwd')).toBe(false);
|
|
expect(isValidURL('ihuwergji')).toBe(false);
|
|
});
|