test: middleware/error

This commit is contained in:
DIYgod
2019-01-29 19:15:06 +08:00
parent 8cec57eaec
commit d2fafd71db
2 changed files with 17 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
const supertest = require('supertest');
const { server } = require('../../lib/index');
const request = supertest(server);
afterAll(() => {
server.close();
});
describe('error', () => {
it(`error`, async () => {
const response = await request.get('/test/0');
expect(response.text).toMatch(/RSSHub 发生了一些意外: <pre>Error: Error test/);
});
});