@@ -36,8 +36,15 @@ describe('TypeParser - Hash wrapper pattern handling', () => {
3636 spec
3737 ) ;
3838
39+ // Should create a named response component
3940 expect ( result ) . toEqual ( {
41+ $ref : '#/components/schemas/CountResponse' ,
42+ } ) ;
43+
44+ // Should add the component to the spec
45+ expect ( spec . components ?. schemas ?. [ 'CountResponse' ] ) . toEqual ( {
4046 type : 'object' ,
47+ description : 'Response containing a count value' ,
4148 properties : {
4249 count : {
4350 type : 'integer' ,
@@ -53,8 +60,15 @@ describe('TypeParser - Hash wrapper pattern handling', () => {
5360 spec
5461 ) ;
5562
63+ // Should create a named response component
5664 expect ( result ) . toEqual ( {
65+ $ref : '#/components/schemas/MergedResponse' ,
66+ } ) ;
67+
68+ // Should add the component to the spec
69+ expect ( spec . components ?. schemas ?. [ 'MergedResponse' ] ) . toEqual ( {
5770 type : 'object' ,
71+ description : 'Response containing a merged value' ,
5872 properties : {
5973 merged : {
6074 type : 'integer' ,
@@ -72,8 +86,15 @@ describe('TypeParser - Hash wrapper pattern handling', () => {
7286 spec
7387 ) ;
7488
89+ // Should create a named response component based on entity name
7590 expect ( result ) . toEqual ( {
91+ $ref : '#/components/schemas/AsyncRefreshResponse' ,
92+ } ) ;
93+
94+ // Should add the response wrapper component to the spec
95+ expect ( spec . components ?. schemas ?. [ 'AsyncRefreshResponse' ] ) . toEqual ( {
7696 type : 'object' ,
97+ description : 'Response containing an AsyncRefresh object' ,
7798 properties : {
7899 async_refresh : {
79100 $ref : '#/components/schemas/AsyncRefresh' ,
@@ -98,8 +119,15 @@ describe('TypeParser - Hash wrapper pattern handling', () => {
98119 spec
99120 ) ;
100121
122+ // Should create a named response component based on entity name
101123 expect ( result ) . toEqual ( {
124+ $ref : '#/components/schemas/StatusResponse' ,
125+ } ) ;
126+
127+ // Should add the response wrapper component to the spec
128+ expect ( spec . components ?. schemas ?. [ 'StatusResponse' ] ) . toEqual ( {
102129 type : 'object' ,
130+ description : 'Response containing an Status object' ,
103131 properties : {
104132 status : {
105133 $ref : '#/components/schemas/Status' ,
@@ -127,8 +155,15 @@ describe('TypeParser - Hash wrapper pattern handling', () => {
127155 spec
128156 ) ;
129157
158+ // Should create a named response component
130159 expect ( result ) . toEqual ( {
160+ $ref : '#/components/schemas/MergedResponse' ,
161+ } ) ;
162+
163+ // Should add the component to the spec
164+ expect ( spec . components ?. schemas ?. [ 'MergedResponse' ] ) . toEqual ( {
131165 type : 'object' ,
166+ description : 'Response containing a merged value' ,
132167 properties : {
133168 merged : {
134169 type : 'boolean' ,
@@ -144,8 +179,15 @@ describe('TypeParser - Hash wrapper pattern handling', () => {
144179 spec
145180 ) ;
146181
182+ // Should create a named response component
147183 expect ( result ) . toEqual ( {
184+ $ref : '#/components/schemas/TotalResponse' ,
185+ } ) ;
186+
187+ // Should add the component to the spec
188+ expect ( spec . components ?. schemas ?. [ 'TotalResponse' ] ) . toEqual ( {
148189 type : 'object' ,
190+ description : 'Response containing a total value' ,
149191 properties : {
150192 total : {
151193 type : 'integer' ,
@@ -161,8 +203,15 @@ describe('TypeParser - Hash wrapper pattern handling', () => {
161203 spec
162204 ) ;
163205
206+ // Should create a named response component
164207 expect ( result ) . toEqual ( {
208+ $ref : '#/components/schemas/NameResponse' ,
209+ } ) ;
210+
211+ // Should add the component to the spec
212+ expect ( spec . components ?. schemas ?. [ 'NameResponse' ] ) . toEqual ( {
165213 type : 'object' ,
214+ description : 'Response containing a name value' ,
166215 properties : {
167216 name : {
168217 type : 'string' ,
@@ -180,8 +229,15 @@ describe('TypeParser - Hash wrapper pattern handling', () => {
180229 spec
181230 ) ;
182231
232+ // Should create a named response component
183233 expect ( result ) . toEqual ( {
234+ $ref : '#/components/schemas/CountResponse' ,
235+ } ) ;
236+
237+ // Should add the component to the spec
238+ expect ( spec . components ?. schemas ?. [ 'CountResponse' ] ) . toEqual ( {
184239 type : 'object' ,
240+ description : 'Response containing a count value' ,
185241 properties : {
186242 count : {
187243 type : 'integer' ,
@@ -197,8 +253,15 @@ describe('TypeParser - Hash wrapper pattern handling', () => {
197253 spec
198254 ) ;
199255
256+ // Should create a named response component based on entity name
200257 expect ( result ) . toEqual ( {
258+ $ref : '#/components/schemas/AsyncRefreshResponse' ,
259+ } ) ;
260+
261+ // Should add the response wrapper component to the spec
262+ expect ( spec . components ?. schemas ?. [ 'AsyncRefreshResponse' ] ) . toEqual ( {
201263 type : 'object' ,
264+ description : 'Response containing an AsyncRefresh object' ,
202265 properties : {
203266 async_refresh : {
204267 $ref : '#/components/schemas/AsyncRefresh' ,
@@ -214,8 +277,15 @@ describe('TypeParser - Hash wrapper pattern handling', () => {
214277 spec
215278 ) ;
216279
280+ // Should create a named response component
217281 expect ( result ) . toEqual ( {
282+ $ref : '#/components/schemas/EnabledResponse' ,
283+ } ) ;
284+
285+ // Should add the component to the spec
286+ expect ( spec . components ?. schemas ?. [ 'EnabledResponse' ] ) . toEqual ( {
218287 type : 'object' ,
288+ description : 'Response containing a enabled value' ,
219289 properties : {
220290 enabled : {
221291 type : 'boolean' ,
0 commit comments