kites
kites copied to clipboard
Support end to end testing
When the application grows, it is hard to manually test a behavior of each API endpoint. The end-to-end tests help us to make sure that everything is working correctly and fits project requirements.
TODO:
- Add new module
@kites/testing
to support end to end testing - Help to init or close application properly
- Support override kites providers and extensions usage
Example:
import { KitesInstance } from '@kites/core';
import { Test } from '@kites/testing';
import * as request from 'supertest';
import { TodoController } from './todo.controller';
import { TodoService } from './todo.service';
describe('Todo e2e', () => {
let app: KitesInstance;
let todoService = { findAll: () => ['list all tasks'] };
beforeAll(async () => {
app = await Test.createApp({
providers: [TodoService],
}).init();
});
it(`/GET list`, () => {
return request(app.express.app)
.get('/api/todo')
.expect(200)
.expect({
data: todoService.findAll(),
});
});
afterAll(async () => {
await app.close();
});
});