mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-10-20 14:41:23 +08:00
test: use axios
This commit is contained in:
+12
-8
@@ -1,5 +1,5 @@
|
||||
const assert = require('assert')
|
||||
const request = require('request')
|
||||
const axios = require('axios')
|
||||
const host = global.host || 'http://localhost:3000'
|
||||
|
||||
describe('测试获取歌词是否正常', () => {
|
||||
@@ -8,14 +8,18 @@ describe('测试获取歌词是否正常', () => {
|
||||
id: 347230,
|
||||
}
|
||||
|
||||
request.get({ url: `${host}/lyric`, qs: qs }, (err, res, body) => {
|
||||
if (!err && res.statusCode == 200) {
|
||||
body = JSON.parse(body)
|
||||
assert(typeof body.lrc !== 'undefined')
|
||||
axios
|
||||
.get(`${host}/lyric`, {
|
||||
params: qs,
|
||||
})
|
||||
.then(({ status, data }) => {
|
||||
if (status == 200) {
|
||||
assert(typeof data.lrc !== 'undefined')
|
||||
}
|
||||
done()
|
||||
} else {
|
||||
})
|
||||
.catch((err) => {
|
||||
done(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user