File size: 709 Bytes
7aec436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { extractProjectId, getTitleFromURL, isValidURL } from '../../src/p4/url-utils';

test('extractProjectId', () => {
  expect(extractProjectId('https://studio.penguinmod.com/#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);
});