1 Star 0 Fork 1

枫洛萧/neteasecloudmusicapi_1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
server.test.js 998 Bytes
一键复制 编辑 原始数据 按行查看 历史
binaryify 提交于 2024-04-30 15:14 . feat: 游客登录机制完善
const fs = require('fs')
const path = require('path')
const tmpPath = require('os').tmpdir()
/** @type {import("express").Express & serverMod.ExpressExtension} */
let app
if (!fs.existsSync(path.resolve(tmpPath, 'anonymous_token'))) {
fs.writeFileSync(path.resolve(tmpPath, 'anonymous_token'), '', 'utf-8')
}
const serverMod = require('./server')
before(async () => {
const generateConfig = require('./generateConfig')
await generateConfig()
app = await serverMod.serveNcmApi({})
if (app.server && app.server.address) {
const addr = app.server.address()
if (addr && typeof addr === 'object' && 'port' in addr) {
global.host = `http://localhost:${addr.port}`
return
}
}
throw new Error('failed to set up host')
})
after((done) => {
if (app.server) {
app.server.close(done)
return
}
throw new Error('failed to set up server')
})
fs.readdirSync(path.join(__dirname, 'test')).forEach((file) => {
require(path.join(__dirname, 'test', file))
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fengluoxiao/neteasecloudmusicapi_1.git
[email protected]:fengluoxiao/neteasecloudmusicapi_1.git
fengluoxiao
neteasecloudmusicapi_1
neteasecloudmusicapi_1
main

搜索帮助