mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-05-23 22:37:41 +08:00
修复测试不通过的问题
This commit is contained in:
parent
b3ca43267a
commit
47bd9175ee
2
beforeTest.js
Normal file
2
beforeTest.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
const generateConfig = require('./generateConfig')
|
||||||
|
generateConfig()
|
@ -4,7 +4,7 @@
|
|||||||
"description": "网易云音乐 NodeJS 版 API",
|
"description": "网易云音乐 NodeJS 版 API",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node app.js",
|
"start": "node app.js",
|
||||||
"test": "mocha -r intelli-espower-loader -t 20000 server.test.js main.test.js --exit",
|
"test": "node beforeTest.js && mocha -r intelli-espower-loader -t 30000 server.test.js main.test.js --exit",
|
||||||
"lint": "eslint \"**/*.{js,ts}\"",
|
"lint": "eslint \"**/*.{js,ts}\"",
|
||||||
"lint-fix": "eslint --fix \"**/*.{js,ts}\"",
|
"lint-fix": "eslint --fix \"**/*.{js,ts}\"",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const host = global.host || 'http://localhost:3000'
|
const host = global.host || 'http://localhost:3000'
|
||||||
|
const config = require('../util/config.json')
|
||||||
describe('测试获取歌手专辑列表是否正常', () => {
|
describe('测试获取歌手专辑列表是否正常', () => {
|
||||||
it('数据的 code 应该为200', (done) => {
|
it('数据的 code 应该为200', (done) => {
|
||||||
const qs = {
|
const qs = {
|
||||||
id: 32311,
|
id: 32311,
|
||||||
|
cookie: config.anonymous_token,
|
||||||
}
|
}
|
||||||
|
|
||||||
axios
|
axios
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const host = global.host || 'http://localhost:3000'
|
const host = global.host || 'http://localhost:3000'
|
||||||
|
const config = require('../util/config.json')
|
||||||
describe('测试获取评论是否正常', () => {
|
describe('测试获取评论是否正常', () => {
|
||||||
it('数据的 code 应该为200', (done) => {
|
it('数据的 code 应该为200', (done) => {
|
||||||
const qs = {
|
const qs = {
|
||||||
id: 32311,
|
id: 32311,
|
||||||
|
cookie: config.anonymous_token,
|
||||||
}
|
}
|
||||||
|
|
||||||
axios
|
axios
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const host = global.host || 'http://localhost:3000'
|
const host = global.host || 'http://localhost:3000'
|
||||||
|
const config = require('../util/config.json')
|
||||||
describe('测试获取歌词是否正常', () => {
|
describe('测试获取歌词是否正常', () => {
|
||||||
it('数据应该有 lrc 字段', (done) => {
|
it('数据应该有 lrc 字段', (done) => {
|
||||||
const qs = {
|
const qs = {
|
||||||
id: 347230,
|
id: 347230,
|
||||||
|
cookie: config.anonymous_token,
|
||||||
}
|
}
|
||||||
|
|
||||||
axios
|
axios
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const host = global.host || 'http://localhost:3000'
|
const host = global.host || 'http://localhost:3000'
|
||||||
|
const config = require('../util/config.json')
|
||||||
describe('测试获取歌曲是否正常', () => {
|
describe('测试获取歌曲是否正常', () => {
|
||||||
it('歌曲的 url 不应该为空', (done) => {
|
it('歌曲的 url 不应该为空', (done) => {
|
||||||
const qs = {
|
const qs = {
|
||||||
id: 462791935,
|
id: 462791935,
|
||||||
br: 999000,
|
br: 999000,
|
||||||
realIP: '116.25.146.177',
|
realIP: '116.25.146.177',
|
||||||
|
cookie: config.anonymous_token,
|
||||||
}
|
}
|
||||||
|
|
||||||
axios
|
axios
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const host = global.host || 'http://localhost:3000'
|
const host = global.host || 'http://localhost:3000'
|
||||||
|
const config = require('../util/config.json')
|
||||||
describe('测试搜索是否正常', () => {
|
describe('测试搜索是否正常', () => {
|
||||||
it('获取到的数据的 name 应该和搜索关键词一致', (done) => {
|
it('获取到的数据的 name 应该和搜索关键词一致', (done) => {
|
||||||
const qs = {
|
const qs = {
|
||||||
keywords: '海阔天空',
|
keywords: '海阔天空',
|
||||||
type: 1,
|
type: 1,
|
||||||
|
cookie: config.anonymous_token,
|
||||||
}
|
}
|
||||||
axios
|
axios
|
||||||
.get(`${host}/search`, {
|
.get(`${host}/search`, {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{ "anonymous_token": "登录网易云音乐网页版,此字段值替换为cookie中MUSIC_U对应的值",
|
{
|
||||||
|
"anonymous_token": "bf8bfeabb1aa84f9c8c3906c04a04fb864322804c83f5d607e91a04eae463c9436bd1a17ec353cf742a0e13bf4a3d0575ac3ffbf24b9c165993166e004087dd3a20e6c18bed612c072ea5b4f70e962ab276621b2ff13050f1471df55ea867f53807e650dd04abd3fb8130b7ae43fcc5b",
|
||||||
"resourceTypeMap": {
|
"resourceTypeMap": {
|
||||||
"0": "R_SO_4_",
|
"0": "R_SO_4_",
|
||||||
"1": "R_MV_5_",
|
"1": "R_MV_5_",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user