Spaces:
Running
Running
File size: 1,290 Bytes
9a43362 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | /**
* Tests for URL parser/orchestrator
*/
import { isParseableURL, getPlatformType } from './url';
describe('URL Parser', () => {
describe('isParseableURL', () => {
it('should identify parseable Instagram URLs', () => {
expect(isParseableURL('https://instagram.com/p/Abc123')).toBe(true);
});
it('should identify parseable Twitter URLs', () => {
expect(isParseableURL('https://twitter.com/user/status/123')).toBe(true);
});
it('should identify parseable web URLs', () => {
expect(isParseableURL('https://example.com/article')).toBe(true);
});
it('should reject invalid URLs', () => {
expect(isParseableURL('not a url')).toBe(false);
});
});
describe('getPlatformType', () => {
it('should detect Instagram platform', () => {
expect(getPlatformType('https://instagram.com/p/Abc123')).toBe('instagram');
});
it('should detect Twitter platform', () => {
expect(getPlatformType('https://twitter.com/user/status/123')).toBe('twitter');
});
it('should detect web platform', () => {
expect(getPlatformType('https://example.com')).toBe('web');
});
it('should return unknown for invalid URLs', () => {
expect(getPlatformType('not a url')).toBe('unknown');
});
});
});
|