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

17 lines
540 B
TypeScript
Raw Normal View History

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