mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2024-11-02 06:33:42 +08:00
22 lines
506 B
TypeScript
22 lines
506 B
TypeScript
|
import { createApp, close, createHttpRequest } from '@midwayjs/mock';
|
||
|
import { Framework } from '@midwayjs/koa';
|
||
|
|
||
|
describe('test/controller/home.test.ts', () => {
|
||
|
|
||
|
it('should GET /', async () => {
|
||
|
// create app
|
||
|
const app = await createApp<Framework>();
|
||
|
|
||
|
// make request
|
||
|
const result = await createHttpRequest(app).get('/');
|
||
|
|
||
|
// use expect by jest
|
||
|
expect(result.status).toBe(200);
|
||
|
expect(result.text).toBe('Hello Midwayjs!');
|
||
|
|
||
|
// close app
|
||
|
await close(app);
|
||
|
});
|
||
|
|
||
|
});
|