@@ -35,13 +35,39 @@ describe('Replicate client', () => {
3535 } ) ;
3636 } ) ;
3737
38+ describe ( 'collections.list' , ( ) => {
39+ test ( 'Calls the correct API route' , async ( ) => {
40+ nock ( BASE_URL )
41+ . get ( '/collections' )
42+ . reply ( 200 , {
43+ results : [
44+ {
45+ name : 'Super resolution' ,
46+ slug : 'super-resolution' ,
47+ description : 'Upscaling models that create high-quality images from low-quality images.' ,
48+ } ,
49+ {
50+ name : 'Image classification' ,
51+ slug : 'image-classification' ,
52+ description : 'Models that classify images.' ,
53+ } ,
54+ ] ,
55+ next : null ,
56+ previous : null ,
57+ } ) ;
58+
59+ const collections = await client . collections . list ( ) ;
60+ expect ( collections . results . length ) . toBe ( 2 ) ;
61+ } ) ;
62+ // Add more tests for error handling, edge cases, etc.
63+ } ) ;
64+
3865 describe ( 'collections.get' , ( ) => {
3966 test ( 'Calls the correct API route' , async ( ) => {
4067 nock ( BASE_URL ) . get ( '/collections/super-resolution' ) . reply ( 200 , {
4168 name : 'Super resolution' ,
4269 slug : 'super-resolution' ,
43- description :
44- 'Upscaling models that create high-quality images from low-quality images.' ,
70+ description : 'Upscaling models that create high-quality images from low-quality images.' ,
4571 models : [ ] ,
4672 } ) ;
4773
0 commit comments