mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-05-23 22:37:41 +08:00
correct some mistakes for global variable
This commit is contained in:
parent
981c0f7d39
commit
1bef762d74
@ -1,16 +1,18 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const request = require('request')
|
||||||
|
|
||||||
let app
|
let app
|
||||||
before(() => {
|
before(() => {
|
||||||
app = require('./app.js')
|
app = require('./app.js')
|
||||||
global.host = 'http://localhost:' + app.server.address().port
|
global.host = 'http://localhost:' + app.server.address().port
|
||||||
|
request.debug = false
|
||||||
})
|
})
|
||||||
after((done) => {
|
after((done) => {
|
||||||
app.server.close(done)
|
app.server.close(done)
|
||||||
})
|
})
|
||||||
|
|
||||||
fs.readdirSync(path.resolve(__dirname, 'test'))
|
fs.readdirSync(path.join(__dirname, 'test'))
|
||||||
.forEach(file => {
|
.forEach(file => {
|
||||||
require('./test/' + file)
|
require(path.join(__dirname, 'test', file))
|
||||||
})
|
})
|
@ -1,6 +1,6 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const request = require('request')
|
const request = require('request')
|
||||||
host = global.host || 'http://localhost:3000'
|
const host = global.host || 'http://localhost:3000'
|
||||||
|
|
||||||
describe('测试获取歌手专辑列表是否正常', () => {
|
describe('测试获取歌手专辑列表是否正常', () => {
|
||||||
it('数据的 code 应该为200', done => {
|
it('数据的 code 应该为200', done => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const request = require('request')
|
const request = require('request')
|
||||||
host = global.host || 'http://localhost:3000'
|
const host = global.host || 'http://localhost:3000'
|
||||||
|
|
||||||
describe('测试获取评论是否正常', () => {
|
describe('测试获取评论是否正常', () => {
|
||||||
it('数据的 code 应该为200', done => {
|
it('数据的 code 应该为200', done => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const request = require('request')
|
const request = require('request')
|
||||||
host = global.host || 'http://localhost:3000'
|
const host = global.host || 'http://localhost:3000'
|
||||||
|
|
||||||
console.log("注意: 测试登录需在 test/login.test.js 中填写账号密码!!!");
|
console.log("注意: 测试登录需在 test/login.test.js 中填写账号密码!!!");
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const request = require('request')
|
const request = require('request')
|
||||||
host = global.host || 'http://localhost:3000'
|
const host = global.host || 'http://localhost:3000'
|
||||||
|
|
||||||
describe("测试获取歌词是否正常", () => {
|
describe("测试获取歌词是否正常", () => {
|
||||||
it("数据应该有 lrc 字段", done => {
|
it("数据应该有 lrc 字段", done => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const request = require('request')
|
const request = require('request')
|
||||||
host = global.host || 'http://localhost:3000'
|
const host = global.host || 'http://localhost:3000'
|
||||||
|
|
||||||
describe("测试获取歌曲是否正常", () => {
|
describe("测试获取歌曲是否正常", () => {
|
||||||
it("歌曲的 url 不应该为空", done => {
|
it("歌曲的 url 不应该为空", done => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const request = require('request')
|
const request = require('request')
|
||||||
host = global.host || 'http://localhost:3000'
|
const host = global.host || 'http://localhost:3000'
|
||||||
|
|
||||||
describe('测试搜索是否正常', () => {
|
describe('测试搜索是否正常', () => {
|
||||||
it('获取到的数据的 name 应该和搜索关键词一致', done => {
|
it('获取到的数据的 name 应该和搜索关键词一致', done => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user