Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosesteven committed Dec 19, 2024
1 parent f73ddbb commit 627f6a1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
15 changes: 7 additions & 8 deletions dist/providers/anime/anix.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/providers/anime/anix.js.map

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions src/providers/anime/anix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,22 +358,21 @@ class Anix extends AnimeParser {
break;
}
}
if (defaultUrl == '') defaultUrl = data[0].url;
} else {
defaultUrl = data[0].url;
}

episodeSources.sources.push({
url: defaultUrl,
quality: `default`,
isM3U8: defaultUrl.includes('.m3u8'),
});
if (defaultUrl != '')
episodeSources.sources.push({
url: defaultUrl,
quality: `default`,
isM3U8: defaultUrl.includes('.m3u8'),
});
} else {
console.error('No JSON data found in loadIframePlayer call.');
}
});

if (!defaultUrl.includes('.mp4')) {
if (defaultUrl != '' && !defaultUrl.includes('.mp4')) {
const options = {
headers: {
Referer: url,
Expand Down
5 changes: 2 additions & 3 deletions test/anime/anix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ test('returns a filled object of episode sources (type: raw)', async () => {
expect(data.subtitles).not.toEqual([]);
});

test('returns a filled object of episode sources (type: invalid option)', async () => {
test('returns a empty object of episode sources (type: invalid option)', async () => {
const data = await anix.fetchEpisodeSources('dandadan', 'ep-11', undefined, 'invalid');
expect(data.sources).not.toEqual([]);
expect(data.subtitles).not.toEqual([]);
expect(data.sources).toEqual([]);
});

0 comments on commit 627f6a1

Please sign in to comment.