Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support end to end testing #24

Open
vunb opened this issue Aug 27, 2019 · 0 comments
Open

Support end to end testing #24

vunb opened this issue Aug 27, 2019 · 0 comments

Comments

@vunb
Copy link
Member

vunb commented Aug 27, 2019

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();
  });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant