@@ -92,4 +92,31 @@ func TestCollectionExtensions(t *testing.T) {
9292 require .NoError (t , err )
9393 assert .Equal (t , string (expected ), string (actual ))
9494 })
95+
96+ t .Run ("Test Successful Generation (with x-no-pagination flag set)" , func (t * testing.T ) {
97+ tmpDir := t .TempDir ()
98+ d , err := GenerateDataStruct (ExtensionsConfig {
99+ Input : filepath .Join ("testdata" , "collections" , "test-x-no-pagination.json" ),
100+ Template : filepath .Join ("templates" , "entities.go.tmpl" ),
101+ Output : filepath .Join (tmpDir , "test.go" ),
102+ ClientPackagePath : filepath .Join (".." , ".." , "client" ),
103+ })
104+ require .NoError (t , err )
105+
106+ swagger , err := loadAPIDefinition (d .SpecPath )
107+ require .NoError (t , err )
108+
109+ d .Params , err = GetCollections (swagger )
110+ require .NoError (t , err )
111+
112+ err = GenerateTemplateFile (context .Background (), d )
113+ assert .NoError (t , err )
114+ assert .FileExists (t , d .DestinationPath )
115+
116+ expected , err := filesystem .ReadFile (filepath .Join ("testdata" , "collections" , "test-x-no-pagination.gen.go" ))
117+ require .NoError (t , err )
118+ actual , err := filesystem .ReadFile (d .DestinationPath )
119+ require .NoError (t , err )
120+ assert .Equal (t , string (expected ), string (actual ))
121+ })
95122}
0 commit comments