Skip to content

Commit

Permalink
test: add /a.json (serve middlewaire) test case and passed
Browse files Browse the repository at this point in the history
  • Loading branch information
npmstudy committed Dec 12, 2023
1 parent 64c9e00 commit 38efd4a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/app/src/__tests__/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('app', async () => {
debug: false,
mount: './f',
buildin: {
serve: { enable: true, root: join(import.meta.url, '.', 'public'), opts: {} },
serve: { enable: true, root: join(import.meta.url, '../..', 'public'), opts: {} },
cors: { enable: true },
// jwt: {
// enable: true,
Expand Down Expand Up @@ -103,6 +103,13 @@ describe('app', async () => {
expect(res.body).toEqual({ a: 'hello' });
});

it('should access /a.json', async () => {
const res = await request.get('/a.json');
expect(res.type).toEqual('application/json');
expect(res.status).toEqual(200);
expect(res.body).toEqual({ a: 123 });
});

it.only('should access /view', async () => {
const res = await request.get('/view');
expect(res.type).toEqual('text/html');
Expand Down

0 comments on commit 38efd4a

Please sign in to comment.