25 lines
1.1 KiB
TypeScript
25 lines
1.1 KiB
TypeScript
import winston from 'winston';
|
|
import { createTestContext } from '../test';
|
|
import { CountryCode } from '../types';
|
|
import { FetcherMock } from '../utils';
|
|
import { ExtractorRegistry } from './ExtractorRegistry';
|
|
import { VidSrc } from './VidSrc';
|
|
|
|
const logger = winston.createLogger({ transports: [new winston.transports.Console({ level: 'nope' })] });
|
|
const extractorRegistry = new ExtractorRegistry(logger, [new VidSrc(new FetcherMock(`${__dirname}/__fixtures__/VidSrc`))]);
|
|
|
|
const ctx = createTestContext();
|
|
|
|
describe('VidSrc', () => {
|
|
test('Full Metal Jacket', async () => {
|
|
expect(await extractorRegistry.handle(ctx, new URL('https://vidsrc.xyz/embed/movie/tt0093058'), CountryCode.en, 'Full Metal Jacket (1987)')).toMatchSnapshot();
|
|
});
|
|
|
|
test('Black Mirror', async () => {
|
|
expect(await extractorRegistry.handle(ctx, new URL('https://vidsrc.xyz/embed/tv/tt2085059/4/2'), CountryCode.en, 'Black Mirror 4x2')).toMatchSnapshot();
|
|
});
|
|
|
|
test('not found', async () => {
|
|
expect(await extractorRegistry.handle(ctx, new URL('https://vidsrc.xyz/embed/movie/tt35628853'), CountryCode.en, 'Black Mirror 4x2')).toMatchSnapshot();
|
|
});
|
|
});
|