Skip to content

Commit

Permalink
chore: refact
Browse files Browse the repository at this point in the history
  • Loading branch information
npmstudy committed Nov 29, 2023
1 parent 990e380 commit 45e8df6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/core/src/__tests__/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ describe('app', async () => {
}
});

rpc.fn('com.yourcompony.a', function (a: string) {
return { a: a };
});

rpc.fn('com.yourcompony.b', function (a: string) {
return `${this.path} , ${a} `;
});

const request = supertest(rpc.callback());

it('should acess /a', async () => {
Expand All @@ -47,4 +55,11 @@ describe('app', async () => {
expect(res.status).toEqual(200);
expect(res.body).toEqual({ a: 'hello', method: 'post' });
});

it('should acess com.yourcompony.b', async () => {
const res = await request.get('/api/com/yourcompony/b?$p=["hello"]');
expect(res.type).toEqual('text/plain');
expect(res.status).toEqual(200);
expect(res.text).toEqual('/com/yourcompony/b , hello ');
});
});

0 comments on commit 45e8df6

Please sign in to comment.