@@ -144,109 +144,6 @@ describe('ResourcesController (e2e)', () => {
144144 } ) ;
145145 } ) ;
146146
147- describe ( 'GET /api/v1/namespaces/:namespaceId/resources' , ( ) => {
148- let resourceId : string ;
149- const testAttrs = {
150- custom : 'attribute' ,
151- nested : { key : 'value' } ,
152- number : 42 ,
153- } ;
154-
155- beforeEach ( async ( ) => {
156- // Create a resource for testing
157- const resourceData = {
158- name : 'Test Resource for Query' ,
159- namespaceId : client . namespace . id ,
160- resourceType : ResourceType . DOC ,
161- parentId : client . namespace . root_resource_id ,
162- content : 'Test content' ,
163- tags : [ 'test' ] ,
164- attrs : testAttrs ,
165- } ;
166-
167- const response = await client
168- . post ( `/api/v1/namespaces/${ client . namespace . id } /resources` )
169- . send ( resourceData )
170- . expect ( HttpStatus . CREATED ) ;
171- resourceId = response . body . id ;
172- } ) ;
173-
174- it ( 'should find resource by single ID and validate attrs match source' , async ( ) => {
175- const response = await client
176- . get (
177- `/api/v1/namespaces/${ client . namespace . id } /resources?id=${ resourceId } ` ,
178- )
179- . expect ( HttpStatus . OK ) ;
180-
181- expect ( Array . isArray ( response . body ) ) . toBe ( true ) ;
182- expect ( response . body ) . toHaveLength ( 1 ) ;
183- expect ( response . body [ 0 ] . id ) . toBe ( resourceId ) ;
184- expect ( response . body [ 0 ] . attrs ) . toEqual ( testAttrs ) ;
185- } ) ;
186-
187- it ( 'should find resources by multiple IDs and validate attrs match source' , async ( ) => {
188- // Create another resource with different attrs
189- const testAttrs2 = {
190- different : 'attrs' ,
191- array : [ 1 , 2 , 3 ] ,
192- boolean : true ,
193- } ;
194- const resourceData2 = {
195- name : 'Second Test Resource' ,
196- namespaceId : client . namespace . id ,
197- resourceType : ResourceType . DOC ,
198- parentId : client . namespace . root_resource_id ,
199- content : 'Second test content' ,
200- tags : [ 'test2' ] ,
201- attrs : testAttrs2 ,
202- } ;
203-
204- const response2 = await client
205- . post ( `/api/v1/namespaces/${ client . namespace . id } /resources` )
206- . send ( resourceData2 )
207- . expect ( HttpStatus . CREATED ) ;
208- const resourceId2 = response2 . body . id ;
209-
210- const response = await client
211- . get (
212- `/api/v1/namespaces/${ client . namespace . id } /resources?id=${ resourceId } ,${ resourceId2 } ` ,
213- )
214- . expect ( HttpStatus . OK ) ;
215-
216- expect ( Array . isArray ( response . body ) ) . toBe ( true ) ;
217- expect ( response . body ) . toHaveLength ( 2 ) ;
218- const ids = response . body . map ( ( r : any ) => r . id ) ;
219- expect ( ids ) . toContain ( resourceId ) ;
220- expect ( ids ) . toContain ( resourceId2 ) ;
221-
222- // Validate attrs for both resources
223- const resource1 = response . body . find ( ( r : any ) => r . id === resourceId ) ;
224- const resource2 = response . body . find ( ( r : any ) => r . id === resourceId2 ) ;
225- expect ( resource1 . attrs ) . toEqual ( testAttrs ) ;
226- expect ( resource2 . attrs ) . toEqual ( testAttrs2 ) ;
227- } ) ;
228-
229- it ( 'should return empty array when no ID provided' , async ( ) => {
230- const response = await client
231- . get ( `/api/v1/namespaces/${ client . namespace . id } /resources` )
232- . expect ( HttpStatus . OK ) ;
233-
234- expect ( Array . isArray ( response . body ) ) . toBe ( true ) ;
235- expect ( response . body ) . toHaveLength ( 0 ) ;
236- } ) ;
237-
238- it ( 'should return empty array for non-existent IDs' , async ( ) => {
239- const response = await client
240- . get (
241- `/api/v1/namespaces/${ client . namespace . id } /resources?id=non-existent-id` ,
242- )
243- . expect ( HttpStatus . OK ) ;
244-
245- expect ( Array . isArray ( response . body ) ) . toBe ( true ) ;
246- expect ( response . body ) . toHaveLength ( 0 ) ;
247- } ) ;
248- } ) ;
249-
250147 describe ( 'GET /api/v1/namespaces/:namespaceId/resources/:resourceId' , ( ) => {
251148 let resourceId : string ;
252149
@@ -941,14 +838,14 @@ describe('ResourcesController (e2e)', () => {
941838 it ( 'should fail without authentication token' , async ( ) => {
942839 await client
943840 . request ( )
944- . get ( `/api/v1/namespaces/${ client . namespace . id } /resources ` )
841+ . get ( `/api/v1/namespaces/${ client . namespace . id } /root ` )
945842 . expect ( HttpStatus . UNAUTHORIZED ) ;
946843 } ) ;
947844
948845 it ( 'should fail with invalid authentication token' , async ( ) => {
949846 await client
950847 . request ( )
951- . get ( `/api/v1/namespaces/${ client . namespace . id } /resources ` )
848+ . get ( `/api/v1/namespaces/${ client . namespace . id } /root ` )
952849 . set ( 'Authorization' , 'Bearer invalid-token' )
953850 . expect ( HttpStatus . UNAUTHORIZED ) ;
954851 } ) ;
@@ -1018,18 +915,6 @@ describe('ResourcesController (e2e)', () => {
1018915 expect ( response . body . attrs ) . toEqual ( complexAttrs ) ;
1019916 } ) ;
1020917
1021- it ( 'should preserve attrs in GET multiple resources endpoint' , async ( ) => {
1022- const response = await client
1023- . get (
1024- `/api/v1/namespaces/${ client . namespace . id } /resources?id=${ testResourceId } ` ,
1025- )
1026- . expect ( HttpStatus . OK ) ;
1027-
1028- expect ( Array . isArray ( response . body ) ) . toBe ( true ) ;
1029- expect ( response . body ) . toHaveLength ( 1 ) ;
1030- expect ( response . body [ 0 ] . attrs ) . toEqual ( complexAttrs ) ;
1031- } ) ;
1032-
1033918 it ( 'should preserve attrs in query endpoint' , async ( ) => {
1034919 const response = await client
1035920 . get (
0 commit comments