Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
kokororin committed Feb 13, 2020
1 parent 5a5929c commit 79e9a05
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 80 deletions.
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": true,
"useTabs": false
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ const generator = require('muse-json-generator');

## License

© 2017 MoeFront Studio | The MIT License (MIT).
© 2017-2020 MoeFront Studio | The MIT License (MIT).
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@
"dependencies": {
"chalk": "^2.2.0",
"commander": "^2.11.0",
"get-proxy": "^2.1.0",
"honoka": "^0.4.4",
"https-proxy-agent": "^2.1.0",
"lodash": "^4.17.15",
"ora": "^1.3.0",
"pjson": "^1.0.9",
Expand Down
File renamed without changes.
13 changes: 7 additions & 6 deletions src/registerHonoka.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import honoka, { HonokaRequestOptions } from 'honoka';
import * as ProxyAgent from 'https-proxy-agent';
import * as getProxy from 'get-proxy';
// import * as ProxyAgent from 'https-proxy-agent';
// import * as getProxy from 'get-proxy';
import Config from './Config';

let hasRegistered: boolean = false;
Expand All @@ -10,14 +10,15 @@ export default function registerHonoka(): void {
return;
}

const sysProxy = getProxy();
// const sysProxy = getProxy();
// console.log(sysProxy);

honoka.defaults.baseURL = Config.NeteaseBaseURL;
honoka.interceptors.register({
request: (options: HonokaRequestOptions) => {
if (sysProxy) {
options.agent = new ProxyAgent(sysProxy);
}
// if (sysProxy) {
// options.agent = new ProxyAgent(sysProxy);
// }
return options;
}
});
Expand Down
19 changes: 6 additions & 13 deletions test/generatorTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,13 @@ const expect = chai.expect;
const BIN_PATH = `node ${path.join(__dirname, '/../bin/muse.js')}`;
const ORIGINAL_REGEX = /music.126.net/;
const TEST_SONGS = [
477331181, // normal
480097777, // normal
26214326, // multiple artists
1333128434, // normal
541687281, // normal
165340, // multiple artists
404, // not found
1818227 // without lyric
];
const PLAYLIST_KEYS = [
'title',
'artist',
'cover',
'src',
'lyric',
'translation'
857896 // without lyric
];
const PLAYLIST_KEYS = ['title', 'artist', 'cover', 'src', 'lyric'];

describe('generator function test', () => {
afterEach(() => {
Expand Down Expand Up @@ -90,7 +83,7 @@ describe('generator function test', () => {
it('lyric should be empty when a song has not lyric (muse will handle it normally)', async () => {
let playlist: any = await generator(TEST_SONGS[4]);
playlist = JSON.parse(playlist);
expect(playlist[0].lyric).to.be.equal('');
expect(playlist[0].lyric).to.be.oneOf(['', undefined]);
});

it('should throw error when input is empty', () => {
Expand Down
59 changes: 1 addition & 58 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ abbrev@1.0.x:
version "1.0.9"
resolved "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135"

agent-base@^4.1.0:
version "4.1.2"
resolved "https://registry.npmjs.org/agent-base/-/agent-base-4.1.2.tgz#80fa6cde440f4dcf9af2617cf246099b5d99f0c8"
dependencies:
es6-promisify "^5.0.0"

ajv@^5.1.0:
version "5.2.3"
resolved "https://registry.npmjs.org/ajv/-/ajv-5.2.3.tgz#c06f598778c44c6b161abafe3466b81ad1814ed2"
Expand Down Expand Up @@ -448,13 +442,6 @@ concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"

config-chain@^1.1.11:
version "1.1.11"
resolved "https://registry.npmjs.org/config-chain/-/config-chain-1.1.11.tgz#aba09747dfbe4c3e70e766a6e41586e1859fc6f2"
dependencies:
ini "^1.3.4"
proto-list "~1.2.1"

configstore@^2.0.0:
version "2.1.0"
resolved "https://registry.npmjs.org/configstore/-/configstore-2.1.0.tgz#737a3a7036e9886102aa6099e47bb33ab1aba1a1"
Expand Down Expand Up @@ -543,12 +530,6 @@ debug@^2.2.0, debug@^2.6.3, debug@^2.6.8:
dependencies:
ms "2.0.0"

debug@^3.1.0:
version "3.1.0"
resolved "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
dependencies:
ms "2.0.0"

decamelize@^1.0.0, decamelize@^1.1.2:
version "1.2.0"
resolved "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
Expand Down Expand Up @@ -671,16 +652,6 @@ error-ex@^1.2.0:
dependencies:
is-arrayish "^0.2.1"

es6-promise@^4.0.3:
version "4.1.1"
resolved "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz#8811e90915d9a0dba36274f0b242dbda78f9c92a"

es6-promisify@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
dependencies:
es6-promise "^4.0.3"

escape-string-applescript@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/escape-string-applescript/-/escape-string-applescript-1.0.0.tgz#6f1c2294245d82c63bc03338dc19a94aa8428892"
Expand Down Expand Up @@ -772,12 +743,6 @@ get-func-name@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41"

get-proxy@^2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/get-proxy/-/get-proxy-2.1.0.tgz#349f2b4d91d44c4d4d4e9cba2ad90143fac5ef93"
dependencies:
npm-conf "^1.1.0"

get-stdin@^4.0.1:
version "4.0.1"
resolved "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe"
Expand Down Expand Up @@ -946,13 +911,6 @@ http-signature@~1.2.0:
jsprim "^1.2.2"
sshpk "^1.7.0"

https-proxy-agent@^2.1.0:
version "2.1.1"
resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.1.1.tgz#a7ce4382a1ba8266ee848578778122d491260fd9"
dependencies:
agent-base "^4.1.0"
debug "^3.1.0"

iconv-lite@~0.4.13:
version "0.4.19"
resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b"
Expand All @@ -978,7 +936,7 @@ inherits@2, inherits@~2.0.1, inherits@~2.0.3:
version "2.0.3"
resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"

ini@^1.3.4, ini@~1.3.0:
ini@~1.3.0:
version "1.3.4"
resolved "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e"

Expand Down Expand Up @@ -1470,13 +1428,6 @@ normalize-package-data@^2.3.2, normalize-package-data@^2.3.4:
semver "2 || 3 || 4 || 5"
validate-npm-package-license "^3.0.1"

npm-conf@^1.1.0:
version "1.1.2"
resolved "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.2.tgz#170a2c48a0c6ad0495f03f87aec2da11ef47a525"
dependencies:
config-chain "^1.1.11"
pify "^3.0.0"

npm-run-path@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-1.0.0.tgz#f5c32bf595fe81ae927daec52e82f8b000ac3c8f"
Expand Down Expand Up @@ -1605,10 +1556,6 @@ pify@^2.0.0, pify@^2.2.0, pify@^2.3.0:
version "2.3.0"
resolved "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"

pify@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176"

pinkie-promise@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-1.0.0.tgz#d1da67f5482563bb7cf57f286ae2822ecfbf3670"
Expand Down Expand Up @@ -1652,10 +1599,6 @@ propagate@0.4.0:
version "0.4.0"
resolved "https://registry.npmjs.org/propagate/-/propagate-0.4.0.tgz#f3fcca0a6fe06736a7ba572966069617c130b481"

proto-list@~1.2.1:
version "1.2.4"
resolved "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"

pseudomap@^1.0.2:
version "1.0.2"
resolved "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
Expand Down

0 comments on commit 79e9a05

Please sign in to comment.