mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 18:13:25 +00:00
update deps, migrate to pnpm
This commit is contained in:
@@ -1,65 +1,71 @@
|
||||
import { makeStandardFetcher } from "@/fetchers/standardFetch";
|
||||
import { makeProviders } from "@/main/builder";
|
||||
import { targets } from "@/main/targets";
|
||||
import { isValidStream } from "@/utils/valid";
|
||||
import fetch from "node-fetch";
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { isValidStream } from '@/utils/valid';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('isValidStream()', () => {
|
||||
it('should pass valid streams', () => {
|
||||
expect(isValidStream({
|
||||
type: "file",
|
||||
id: "a",
|
||||
flags: [],
|
||||
captions: [],
|
||||
qualities: {
|
||||
"1080": {
|
||||
type: "mp4",
|
||||
url: "hello-world"
|
||||
}
|
||||
}
|
||||
})).toBe(true);
|
||||
expect(isValidStream({
|
||||
type: "hls",
|
||||
id: "a",
|
||||
flags: [],
|
||||
captions: [],
|
||||
playlist: "hello-world"
|
||||
})).toBe(true);
|
||||
expect(
|
||||
isValidStream({
|
||||
type: 'file',
|
||||
id: 'a',
|
||||
flags: [],
|
||||
captions: [],
|
||||
qualities: {
|
||||
'1080': {
|
||||
type: 'mp4',
|
||||
url: 'hello-world',
|
||||
},
|
||||
},
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(
|
||||
isValidStream({
|
||||
type: 'hls',
|
||||
id: 'a',
|
||||
flags: [],
|
||||
captions: [],
|
||||
playlist: 'hello-world',
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('should detect empty qualities', () => {
|
||||
expect(isValidStream({
|
||||
type: "file",
|
||||
id: "a",
|
||||
flags: [],
|
||||
captions: [],
|
||||
qualities: {}
|
||||
})).toBe(false);
|
||||
expect(
|
||||
isValidStream({
|
||||
type: 'file',
|
||||
id: 'a',
|
||||
flags: [],
|
||||
captions: [],
|
||||
qualities: {},
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
it('should detect empty stream urls', () => {
|
||||
expect(isValidStream({
|
||||
type: "file",
|
||||
id: "a",
|
||||
flags: [],
|
||||
captions: [],
|
||||
qualities: {
|
||||
"1080": {
|
||||
type: "mp4",
|
||||
url: "",
|
||||
}
|
||||
}
|
||||
})).toBe(false);
|
||||
expect(
|
||||
isValidStream({
|
||||
type: 'file',
|
||||
id: 'a',
|
||||
flags: [],
|
||||
captions: [],
|
||||
qualities: {
|
||||
'1080': {
|
||||
type: 'mp4',
|
||||
url: '',
|
||||
},
|
||||
},
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
it('should detect emtpy HLS playlists', () => {
|
||||
expect(isValidStream({
|
||||
type: "hls",
|
||||
id: "a",
|
||||
flags: [],
|
||||
captions: [],
|
||||
playlist: "",
|
||||
})).toBe(false);
|
||||
expect(
|
||||
isValidStream({
|
||||
type: 'hls',
|
||||
id: 'a',
|
||||
flags: [],
|
||||
captions: [],
|
||||
playlist: '',
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user