@@ -80,11 +80,11 @@ describe('operationPagination', () => {
80
80
type : IR . SchemaObject [ 'type' ] = 'string' ,
81
81
pagination = false ,
82
82
) : IR . ParameterObject => ( {
83
- name ,
83
+ explode : true ,
84
84
location : 'query' ,
85
+ name,
85
86
schema : { type } ,
86
87
style : 'form' ,
87
- explode : true ,
88
88
...( pagination ? { pagination : true } : { } ) ,
89
89
} ) ;
90
90
@@ -129,7 +129,13 @@ describe('operationPagination', () => {
129
129
130
130
it . each ( queryScenarios ) (
131
131
'query params for $operation.id → $hasPagination' ,
132
- ( { hasPagination, operation } : { hasPagination : boolean ; operation : IR . OperationObject } ) => {
132
+ ( {
133
+ hasPagination,
134
+ operation,
135
+ } : {
136
+ hasPagination : boolean ;
137
+ operation : IR . OperationObject ;
138
+ } ) => {
133
139
const result = operationPagination ( { context : emptyContext , operation } ) ;
134
140
expect ( Boolean ( result ) ) . toEqual ( hasPagination ) ;
135
141
} ,
@@ -138,17 +144,17 @@ describe('operationPagination', () => {
138
144
it ( 'body.pagination === true returns entire body' , ( ) => {
139
145
const operation : IR . OperationObject = {
140
146
...baseOperationMeta ,
141
- id : 'bodyTrue' ,
142
147
body : {
143
148
mediaType : 'application/json' ,
144
149
pagination : true ,
145
150
schema : {
146
- type : 'object' ,
147
151
properties : {
148
152
page : { type : 'integer' } ,
149
153
} ,
154
+ type : 'object' ,
150
155
} ,
151
156
} ,
157
+ id : 'bodyTrue' ,
152
158
} ;
153
159
154
160
const result = operationPagination ( { context : emptyContext , operation } ) ;
@@ -161,22 +167,22 @@ describe('operationPagination', () => {
161
167
it ( 'body.pagination = "pagination" returns the matching property' , ( ) => {
162
168
const operation : IR . OperationObject = {
163
169
...baseOperationMeta ,
164
- id : 'bodyField' ,
165
170
body : {
166
171
mediaType : 'application/json' ,
167
172
pagination : 'pagination' ,
168
173
schema : {
169
- type : 'object' ,
170
174
properties : {
171
175
pagination : {
172
- type : 'object' ,
173
176
properties : {
174
177
page : { type : 'integer' } ,
175
178
} ,
179
+ type : 'object' ,
176
180
} ,
177
181
} ,
182
+ type : 'object' ,
178
183
} ,
179
184
} ,
185
+ id : 'bodyField' ,
180
186
} ;
181
187
182
188
const result = operationPagination ( { context : emptyContext , operation } ) ;
@@ -189,26 +195,26 @@ describe('operationPagination', () => {
189
195
it ( 'resolves $ref and uses the resolved pagination property' , ( ) => {
190
196
const context : IR . Context = {
191
197
resolveIrRef : vi . fn ( ) . mockReturnValue ( {
192
- type : 'object' ,
193
198
properties : {
194
199
pagination : {
195
- type : 'object' ,
196
200
properties : {
197
201
page : { type : 'integer' } ,
198
202
} ,
203
+ type : 'object' ,
199
204
} ,
200
205
} ,
206
+ type : 'object' ,
201
207
} ) ,
202
208
} as unknown as IR . Context ;
203
209
204
210
const operation : IR . OperationObject = {
205
211
...baseOperationMeta ,
206
- id : 'refPagination' ,
207
212
body : {
208
213
mediaType : 'application/json' ,
209
214
pagination : 'pagination' ,
210
215
schema : { $ref : '#/components/schemas/PaginationBody' } ,
211
216
} ,
217
+ id : 'refPagination' ,
212
218
} ;
213
219
214
220
const result = operationPagination ( { context, operation } ) ;
@@ -224,20 +230,20 @@ describe('operationPagination', () => {
224
230
it ( 'falls back to query when pagination key not found in body' , ( ) => {
225
231
const operation : IR . OperationObject = {
226
232
...baseOperationMeta ,
227
- id : 'fallback' ,
228
- parameters : {
229
- query : {
230
- cursor : queryParam ( 'cursor' , 'string' , true ) ,
231
- } ,
232
- } ,
233
233
body : {
234
234
mediaType : 'application/json' ,
235
235
pagination : 'pagination' ,
236
236
schema : {
237
- type : 'object' ,
238
237
properties : {
239
238
notPagination : { type : 'string' } ,
240
239
} ,
240
+ type : 'object' ,
241
+ } ,
242
+ } ,
243
+ id : 'fallback' ,
244
+ parameters : {
245
+ query : {
246
+ cursor : queryParam ( 'cursor' , 'string' , true ) ,
241
247
} ,
242
248
} ,
243
249
} ;
@@ -248,4 +254,5 @@ describe('operationPagination', () => {
248
254
expect ( result ?. name ) . toEqual ( 'cursor' ) ;
249
255
expect ( result ?. schema ?. type ) . toEqual ( 'string' ) ;
250
256
} ) ;
251
- } ) ;
257
+ } ) ;
258
+ test ( pagination ) : fix new tests in CI ( 2 )
0 commit comments