remove tests file cuz memleaks

This commit is contained in:
hansputera
2021-11-09 10:10:19 +07:00
parent f9eafe8352
commit f0ca06d84a
6 changed files with 29 additions and 3104 deletions

View File

@@ -1,10 +0,0 @@
module.exports = {
'presets': [
['@babel/preset-env', {
'targets': {
'node': 'current',
},
}],
'@babel/preset-typescript',
],
};

View File

@@ -1,22 +0,0 @@
import type {Config} from '@jest/types';
export default async (): Promise<Config.InitialOptions> => {
return {
'verbose': true,
'clearMocks': true,
'collectCoverage': true,
'coverageDirectory': 'tests__coverages',
'maxConcurrency': 2,
'watchPathIgnorePatterns': [
'./node_modules/',
'./lib/',
],
'testEnvironment': 'node',
'testMatch': [
'**/tests/**/*.+(ts)',
],
'transform': {
'^.+\\.(ts)$': 'ts-jest',
},
};
};

View File

@@ -22,13 +22,12 @@ export class MusicalyDown extends BaseProvider {
*/
@handleException
public async fetch(url: string): Promise<ExtractedInfo> {
const headers = {
'Accept': '*/*',
'Referer': this.client.defaults.options.prefixUrl,
'Origin': this.client.defaults.options.prefixUrl,
};
const res = await this.client('./', {
headers,
'headers': {
'Accept': '*/*',
'Referer': this.client.defaults.options.prefixUrl,
'Origin': this.client.defaults.options.prefixUrl,
},
});
const tokens = (
res.body.match(
@@ -44,7 +43,9 @@ export class MusicalyDown extends BaseProvider {
},
headers: {
'Cookie': res.headers['set-cookie']?.toString(),
...headers,
'Accept': '*/*',
'Referer': this.client.defaults.options.prefixUrl,
'Origin': this.client.defaults.options.prefixUrl,
},
});
@@ -57,16 +58,15 @@ export class MusicalyDown extends BaseProvider {
* @return {ExtractedInfo}
*/
public extract(html: string): ExtractedInfo {
const thumb = /img class="responsive-img" src="(.*?)"/gi.exec(html)?.[1];
const matchUrls = (html
.match(/<a.*?target="_blank".*?href="(.*?)".*?<\/a>/gi) as string[]);
const urls = matchUrls.map((url) =>
/<a.*?target="_blank".*?href="(.*?)".*?<\/a>/gi.exec(url)?.[1] as string);
return {
error: undefined,
result: {
'error': undefined,
'result': {
urls,
thumb,
'thumb': /img class="responsive-img" src="(.*?)"/gi.exec(html)?.[1],
},
};
}

View File

@@ -62,6 +62,7 @@ export class TikmateProvider extends BaseProvider {
* @param {string} html - Raw HTML
* @return {ExtractedInfo}
*/
@handleException
extract(html: string): ExtractedInfo {
const matchs = matchTikmateDownload(deObfuscate(html));
return {

View File

@@ -9,19 +9,12 @@
"ow": "^0.28.1"
},
"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.0",
"@babel/preset-typescript": "^7.16.0",
"@types/ioredis": "^4.28.1",
"@types/jest": "^27.0.2",
"@typescript-eslint/eslint-plugin": "^5.3.0",
"@typescript-eslint/parser": "^5.3.0",
"@vercel/node": "^1.12.1",
"babel-jest": "^27.3.1",
"eslint": "^8.2.0",
"eslint-config-google": "^0.14.0",
"jest": "^27.3.1",
"ts-node": "^10.4.0",
"typescript": "^4.4.4"
},
"scripts": {

3071
yarn.lock

File diff suppressed because it is too large Load Diff