certd/packages/ui/certd-server/test/controller/api.test.ts

18 lines
540 B
TypeScript
Raw Normal View History

2024-07-14 16:30:33 +00:00
import { createHttpRequest } from '@midwayjs/mock';
import { Application } from '@midwayjs/koa';
import assert from 'assert';
import { getApp } from '../setup.js';
2023-01-29 05:44:19 +00:00
describe('test/controller/home.test.ts', () => {
2024-07-14 16:30:33 +00:00
it('should POST /api/get_user', async function (this: any) {
const app: Application = getApp();
2023-01-29 05:44:19 +00:00
// make request
2024-07-14 16:30:33 +00:00
const result = await createHttpRequest(app).get('/api/get_user').query({ uid: 123 });
2023-01-29 05:44:19 +00:00
// use expect by jest
2024-07-14 16:30:33 +00:00
assert(result.status ===200);
assert(result.body.message === 'OK');
2023-01-29 05:44:19 +00:00
});
});