@@ -11,7 +11,11 @@ describe('Elysia adapter tests - rpc handler', () => {
1111 const client = await createTestClient ( schema ) ;
1212
1313 const handler = await createElysiaApp (
14- createElysiaHandler ( { getClient : ( ) => client , basePath : '/api' , apiHandler : new RPCApiHandler ( { schema : client . schema } ) } )
14+ createElysiaHandler ( {
15+ getClient : ( ) => client ,
16+ basePath : '/api' ,
17+ apiHandler : new RPCApiHandler ( { schema : client . schema } ) ,
18+ } ) ,
1519 ) ;
1620
1721 let r = await handler ( makeRequest ( 'GET' , makeUrl ( '/api/post/findMany' , { where : { id : { equals : '1' } } } ) ) ) ;
@@ -31,7 +35,7 @@ describe('Elysia adapter tests - rpc handler', () => {
3135 ] ,
3236 } ,
3337 } ,
34- } )
38+ } ) ,
3539 ) ;
3640 expect ( r . status ) . toBe ( 201 ) ;
3741 expect ( ( await unmarshal ( r ) ) . data ) . toMatchObject ( {
@@ -51,7 +55,7 @@ describe('Elysia adapter tests - rpc handler', () => {
5155 expect ( ( await unmarshal ( r ) ) . data ) . toHaveLength ( 1 ) ;
5256
5357 r = await handler (
54- makeRequest ( 'PUT' , '/api/user/update' , { where : { id : 'user1' } , data : { email : 'user1@def.com' } } )
58+ makeRequest ( 'PUT' , '/api/user/update' , { where : { id : 'user1' } , data : { email : 'user1@def.com' } } ) ,
5559 ) ;
5660 expect ( r . status ) . toBe ( 200 ) ;
5761 expect ( ( await unmarshal ( r ) ) . data . email ) . toBe ( 'user1@def.com' ) ;
@@ -65,14 +69,14 @@ describe('Elysia adapter tests - rpc handler', () => {
6569 expect ( ( await unmarshal ( r ) ) . data . _sum . viewCount ) . toBe ( 3 ) ;
6670
6771 r = await handler (
68- makeRequest ( 'GET' , makeUrl ( '/api/post/groupBy' , { by : [ 'published' ] , _sum : { viewCount : true } } ) )
72+ makeRequest ( 'GET' , makeUrl ( '/api/post/groupBy' , { by : [ 'published' ] , _sum : { viewCount : true } } ) ) ,
6973 ) ;
7074 expect ( r . status ) . toBe ( 200 ) ;
7175 expect ( ( await unmarshal ( r ) ) . data ) . toEqual (
7276 expect . arrayContaining ( [
7377 expect . objectContaining ( { published : true , _sum : { viewCount : 1 } } ) ,
7478 expect . objectContaining ( { published : false , _sum : { viewCount : 2 } } ) ,
75- ] )
79+ ] ) ,
7680 ) ;
7781
7882 r = await handler ( makeRequest ( 'DELETE' , makeUrl ( '/api/user/deleteMany' , { where : { id : 'user1' } } ) ) ) ;
@@ -89,8 +93,8 @@ describe('Elysia adapter tests - rest handler', () => {
8993 createElysiaHandler ( {
9094 getClient : ( ) => client ,
9195 basePath : '/api' ,
92- apiHandler : new RestApiHandler ( { schema : client . $schema , endpoint : 'http://localhost/api' } ) ,
93- } )
96+ apiHandler : new RestApiHandler ( { schema : client . $schema , endpoint : 'http://localhost/api' } ) ,
97+ } ) ,
9498 ) ;
9599
96100 let r = await handler ( makeRequest ( 'GET' , makeUrl ( '/api/post/1' ) ) ) ;
@@ -102,7 +106,7 @@ describe('Elysia adapter tests - rest handler', () => {
102106 type : 'user' ,
103107 attributes : { id : 'user1' , email : 'user1@abc.com' } ,
104108 } ,
105- } )
109+ } ) ,
106110 ) ;
107111 expect ( r . status ) . toBe ( 201 ) ;
108112 expect ( await unmarshal ( r ) ) . toMatchObject ( {
@@ -129,7 +133,7 @@ describe('Elysia adapter tests - rest handler', () => {
129133 r = await handler (
130134 makeRequest ( 'PUT' , makeUrl ( '/api/user/user1' ) , {
131135 data : { type : 'user' , attributes : { email : 'user1@def.com' } } ,
132- } )
136+ } ) ,
133137 ) ;
134138 expect ( r . status ) . toBe ( 200 ) ;
135139 expect ( ( await unmarshal ( r ) ) . data . attributes . email ) . toBe ( 'user1@def.com' ) ;
0 commit comments