Skip to content

Commit

Permalink
[TASK] Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lolamtisch committed Sep 28, 2021
1 parent 583ab42 commit e3e0e01
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions src/pages/MangaPark/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ export const MangaPark: pageInterface = {
languages: ['English'],
type: 'manga',
isSyncPage(url) {
if (
(url.split('/')[3] === 'comic' && url.split('/')[6] !== undefined && /^(c\d+)/.test(url.split('/')[6])) ||
(url.split('/')[3] === 'chapter' && url.split('/')[4] !== undefined && url.split('/')[4])
) {
return true;
}
return false;
return Boolean(url.split('/')[3] === 'comic' && url.split('/')[6] !== undefined && j.$('#viewer').length);
},
isOverviewPage(url) {
if (url.split('/')[3] === 'comic' && url.split('/')[4] !== undefined && url.split('/')[4].length > 0) {
Expand All @@ -31,7 +25,10 @@ export const MangaPark: pageInterface = {
return utils.absoluteLink(j.$('h3.nav-title > a').attr('href'), MangaPark.domain);
},
getEpisode(url) {
let string: any = j.$('#select-episodes option:selected').text();
let string: any = j
.$('#select-chapters option:selected, #select-episodes option:selected')
.first()
.text();
let temp = string.match(/(ch\.|chapter)\D?\d+/i);
if (temp !== null) {
string = temp[0];
Expand All @@ -43,13 +40,16 @@ export const MangaPark: pageInterface = {
return NaN;
},
getVolume(url) {
let string: any = j.$('#select-episodes option:selected').text();
let string: any = j
.$('#select-chapters option:selected, #select-episodes option:selected')
.first()
.text();
let temp = string.match(/(vol\.|volume)\D?\d+/i);
if (temp !== null) {
string = temp[0];
temp = string.match(/\d+/);
if (temp !== null) {
return temp[0];
return Number(temp[0]);
}
}
return NaN;
Expand Down
6 changes: 3 additions & 3 deletions src/pages/MangaPark/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"url": "https://mangapark.net/",
"testCases": [
{
"url": "https://mangapark.net/comic/87224/her-summon/chapter/en/83",
"url": "https://mangapark.net/comic/87224/her-summon/c83-en",
"expected": {
"sync": true,
"title": "Her Summon",
"identifier": "87224",
"overviewUrl": "https://mangapark.net/comic/87224/her-summon",
"nextEpUrl": "https://mangapark.net/comic/87224/her-summon/chapter/en/84",
"nextEpUrl": "https://mangapark.net/comic/87224/her-summon/c84-en",
"episode": 83,
"uiSelector": false
}
Expand All @@ -21,7 +21,7 @@
"title": "Tiger Books",
"identifier": "38239",
"overviewUrl": "https://mangapark.net/comic/38239/tiger-books",
"nextEpUrl": "https://mangapark.net/chapter/3389701",
"nextEpUrl": "https://mangapark.net/comic/38239/tiger-books/i3389701-en-v2-c1",
"episode": 1,
"uiSelector": false
}
Expand Down

0 comments on commit e3e0e01

Please sign in to comment.