mirror of
https://github.com/lyz05/danmaku.git
synced 2026-04-25 19:30:44 +08:00
feat: 更新测试用例
feat: 无法解析会返回一条消息
This commit is contained in:
@@ -4,12 +4,13 @@ let app = require('../app');
|
||||
const { bilibili, mgtv, tencentvideo, youku, iqiyi } = require('../routes/api/base');
|
||||
const list = [bilibili, mgtv, tencentvideo, youku, iqiyi];
|
||||
|
||||
let should = chai.should();
|
||||
chai.use(chaiHttp);
|
||||
|
||||
describe('App', () => {
|
||||
|
||||
describe('弹幕解析模块测试', function () {
|
||||
this.timeout(1000*60);
|
||||
this.timeout(1000*30);
|
||||
it('主页测试', (done) => {
|
||||
chai.request(app)
|
||||
.get('/')
|
||||
@@ -76,7 +77,66 @@ describe('App', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('airportsub modules',()=>{
|
||||
|
||||
describe('airportsub modules',function (){
|
||||
this.timeout(1000*5);
|
||||
it('接口不带参数测试', (done) =>{
|
||||
chai.request(app)
|
||||
.get('/sub')
|
||||
.end((err,res) => {
|
||||
res.should.have.status(400);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('接口错误参数测试', (done) =>{
|
||||
chai.request(app)
|
||||
.get('/sub?abc=123')
|
||||
.end((err,res) => {
|
||||
res.should.have.status(400);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('接口带user参数测试', (done) =>{
|
||||
chai.request(app)
|
||||
.get('/sub?user=congcong')
|
||||
.end((err,res) => {
|
||||
res.should.have.status(200);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('接口错误user参数测试', (done) =>{
|
||||
chai.request(app)
|
||||
.get('/sub?user=123')
|
||||
.end((err,res) => {
|
||||
res.should.have.status(404);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('接口带user与ctype参数测试', (done) =>{
|
||||
chai.request(app)
|
||||
.get('/sub?user=congcong&ctype=v2ray')
|
||||
.end((err,res) => {
|
||||
res.should.have.status(200);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('缓存测试', (done) =>{
|
||||
chai.request(app)
|
||||
.get('/sub/cache')
|
||||
.end((err,res) => {
|
||||
res.should.have.status(200);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('软件下载测试', (done) =>{
|
||||
chai.request(app)
|
||||
.get('/sub/download')
|
||||
.end((err,res) => {
|
||||
res.should.have.status(200);
|
||||
res.text.should.have.string('clash');
|
||||
res.text.should.have.string('v2ray');
|
||||
res.text.should.have.string('shadowsocks');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user