mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-07-06 23:02:07 +08:00
upgrade version 2.0,add login api,upgrade api verison,add document and unit test
This commit is contained in:
23
test/search.test.js
Normal file
23
test/search.test.js
Normal file
@ -0,0 +1,23 @@
|
||||
const assert = require('assert')
|
||||
const crypto = require('crypto')
|
||||
const { createRequest } = require("../util/util")
|
||||
const phone = "换成你的账号"
|
||||
const password = "换成你的密码"
|
||||
|
||||
describe('测试搜索是否正常', () => {
|
||||
it('获取到的数据的 name 应该和搜索关键词一致', done => {
|
||||
const keywords = "海阔天空"
|
||||
const type = 1
|
||||
const limit = 30
|
||||
const data = 's=' + keywords + '&limit=' + limit + '&type=' + type + '&offset=0'
|
||||
createRequest('/api/search/pc/', 'POST', data)
|
||||
.then(result => {
|
||||
console.log(JSON.parse(result).result.songs[0].mp3Url)
|
||||
assert(JSON.parse(result).result.songs[0].name === '海阔天空')
|
||||
done()
|
||||
})
|
||||
.catch(err => {
|
||||
done(err)
|
||||
})
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user