@redocly/openapi-core 1.0.0-beta.124 → 1.0.0-beta.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,13 @@
1
1
  import { Location } from '../../../../ref-utils';
2
2
  import { Source } from '../../../../resolve';
3
- import { Asserts, asserts, buildAssertCustomFunction } from '../asserts';
3
+ import { AssertionFnContext, Asserts, asserts, buildAssertCustomFunction } from '../asserts';
4
4
 
5
5
  let baseLocation = new Location(jest.fn() as any as Source, 'pointer');
6
6
 
7
+ const assertionProperties = {
8
+ baseLocation: baseLocation,
9
+ } as AssertionFnContext;
10
+
7
11
  describe('oas3 assertions', () => {
8
12
  describe('generic rules', () => {
9
13
  const fakeNode = {
@@ -14,12 +18,16 @@ describe('oas3 assertions', () => {
14
18
 
15
19
  describe('pattern', () => {
16
20
  it('value should match regex pattern', () => {
17
- expect(asserts.pattern('test string', '/test/', baseLocation)).toEqual([]);
18
- expect(asserts.pattern('test string', '/test me/', baseLocation)).toEqual([
21
+ expect(asserts.pattern('test string', '/test/', assertionProperties)).toEqual([]);
22
+ expect(asserts.pattern('test string', '/test me/', assertionProperties)).toEqual([
19
23
  { location: baseLocation, message: '"test string" should match a regex /test me/' },
20
24
  ]);
21
- expect(asserts.pattern(['test string', 'test me'], '/test/', baseLocation)).toEqual([]);
22
- expect(asserts.pattern(['test string', 'test me'], '/test me/', baseLocation)).toEqual([
25
+ expect(asserts.pattern(['test string', 'test me'], '/test/', assertionProperties)).toEqual(
26
+ []
27
+ );
28
+ expect(
29
+ asserts.pattern(['test string', 'test me'], '/test me/', assertionProperties)
30
+ ).toEqual([
23
31
  {
24
32
  message: '"test string" should match a regex /test me/',
25
33
  location: baseLocation.key(),
@@ -29,11 +37,11 @@ describe('oas3 assertions', () => {
29
37
  asserts.pattern(
30
38
  './components/smth/test.yaml',
31
39
  '/^(./)?components/.*.yaml$/',
32
- baseLocation
40
+ assertionProperties
33
41
  )
34
42
  ).toEqual([]);
35
43
  expect(
36
- asserts.pattern('./other.yaml', '/^(./)?components/.*.yaml$/', baseLocation)
44
+ asserts.pattern('./other.yaml', '/^(./)?components/.*.yaml$/', assertionProperties)
37
45
  ).toEqual([
38
46
  {
39
47
  message: '"./other.yaml" should match a regex /^(./)?components/.*.yaml$/',
@@ -45,14 +53,16 @@ describe('oas3 assertions', () => {
45
53
 
46
54
  describe('notPattern', () => {
47
55
  it('value should not match regex pattern', () => {
48
- expect(asserts.notPattern('test string', '/test me/', baseLocation)).toEqual([]);
49
- expect(asserts.notPattern('test string', '/test/', baseLocation)).toEqual([
56
+ expect(asserts.notPattern('test string', '/test me/', assertionProperties)).toEqual([]);
57
+ expect(asserts.notPattern('test string', '/test/', assertionProperties)).toEqual([
50
58
  { location: baseLocation, message: '"test string" should not match a regex /test/' },
51
59
  ]);
52
60
  expect(
53
- asserts.notPattern(['test string', 'test me'], '/test other/', baseLocation)
61
+ asserts.notPattern(['test string', 'test me'], '/test other/', assertionProperties)
54
62
  ).toEqual([]);
55
- expect(asserts.notPattern(['test string', 'test me'], '/test me/', baseLocation)).toEqual([
63
+ expect(
64
+ asserts.notPattern(['test string', 'test me'], '/test me/', assertionProperties)
65
+ ).toEqual([
56
66
  {
57
67
  message: '"test me" should not match a regex /test me/',
58
68
  location: baseLocation.key(),
@@ -63,8 +73,13 @@ describe('oas3 assertions', () => {
63
73
 
64
74
  describe('ref', () => {
65
75
  it('value should have ref', () => {
66
- expect(asserts.ref({ $ref: 'text' }, true, baseLocation, { $ref: 'text' })).toEqual([]);
67
- expect(asserts.ref({}, true, baseLocation, {})).toEqual([
76
+ expect(
77
+ asserts.ref({ $ref: 'text' }, true, {
78
+ ...assertionProperties,
79
+ rawValue: { $ref: 'text' },
80
+ })
81
+ ).toEqual([]);
82
+ expect(asserts.ref({}, true, { ...assertionProperties, rawValue: {} })).toEqual([
68
83
  {
69
84
  message: 'should use $ref',
70
85
  location: baseLocation.key(),
@@ -73,37 +88,44 @@ describe('oas3 assertions', () => {
73
88
  });
74
89
 
75
90
  it('value should not have ref', () => {
76
- expect(asserts.ref({ $ref: 'text' }, false, baseLocation, { $ref: 'text' })).toEqual([
91
+ expect(
92
+ asserts.ref({ $ref: 'text' }, false, {
93
+ ...assertionProperties,
94
+ rawValue: { $ref: 'text' },
95
+ })
96
+ ).toEqual([
77
97
  {
78
98
  message: 'should not use $ref',
79
99
  location: baseLocation,
80
100
  },
81
101
  ]);
82
- expect(asserts.ref({}, false, baseLocation, {})).toEqual([]);
102
+ expect(asserts.ref({}, false, { ...assertionProperties, rawValue: {} })).toEqual([]);
83
103
  });
84
104
 
85
105
  it('value should match regex pattern', () => {
86
106
  expect(
87
- asserts.ref({ $ref: 'test string' }, '/test/', baseLocation, { $ref: 'test string' })
107
+ asserts.ref({ $ref: 'test string' }, '/test/', {
108
+ ...assertionProperties,
109
+ rawValue: { $ref: 'test string' },
110
+ })
88
111
  ).toEqual([]);
89
112
  expect(
90
- asserts.ref({ $ref: 'test string' }, '/test me/', baseLocation, { $ref: 'test string' })
113
+ asserts.ref({ $ref: 'test string' }, '/test me/', {
114
+ ...assertionProperties,
115
+ rawValue: { $ref: 'text' },
116
+ })
91
117
  ).toEqual([{ message: '$ref value should match /test me/', location: baseLocation }]);
92
118
  expect(
93
- asserts.ref(
94
- { $ref: './components/smth/test.yaml' },
95
- '/^(./)?components/.*.yaml$/',
96
- baseLocation,
97
- { $ref: './components/smth/test.yaml' }
98
- )
119
+ asserts.ref({ $ref: './components/smth/test.yaml' }, '/^(./)?components/.*.yaml$/', {
120
+ ...assertionProperties,
121
+ rawValue: { $ref: './components/smth/test.yaml' },
122
+ })
99
123
  ).toEqual([]);
100
124
  expect(
101
- asserts.ref(
102
- { $ref: './paths/smth/test.yaml' },
103
- '/^(./)?components/.*.yaml$/',
104
- baseLocation,
105
- { $ref: './paths/smth/test.yaml' }
106
- )
125
+ asserts.ref({ $ref: './paths/smth/test.yaml' }, '/^(./)?components/.*.yaml$/', {
126
+ ...assertionProperties,
127
+ rawValue: { $ref: './paths/smth/test.yaml' },
128
+ })
107
129
  ).toEqual([
108
130
  {
109
131
  message: '$ref value should match /^(./)?components/.*.yaml$/',
@@ -115,24 +137,26 @@ describe('oas3 assertions', () => {
115
137
 
116
138
  describe('enum', () => {
117
139
  it('value should be among predefined keys', () => {
118
- expect(asserts.enum('test', ['test', 'example'], baseLocation)).toEqual([]);
119
- expect(asserts.enum(['test'], ['test', 'example'], baseLocation)).toEqual([]);
120
- expect(asserts.enum(['test', 'example'], ['test', 'example'], baseLocation)).toEqual([]);
121
- expect(asserts.enum(['test', 'example', 'foo'], ['test', 'example'], baseLocation)).toEqual(
122
- [
123
- {
124
- message: '"foo" should be one of the predefined values',
125
- location: baseLocation.child('foo').key(),
126
- },
127
- ]
140
+ expect(asserts.enum('test', ['test', 'example'], assertionProperties)).toEqual([]);
141
+ expect(asserts.enum(['test'], ['test', 'example'], assertionProperties)).toEqual([]);
142
+ expect(asserts.enum(['test', 'example'], ['test', 'example'], assertionProperties)).toEqual(
143
+ []
128
144
  );
129
- expect(asserts.enum('test', ['foo', 'example'], baseLocation)).toEqual([
145
+ expect(
146
+ asserts.enum(['test', 'example', 'foo'], ['test', 'example'], assertionProperties)
147
+ ).toEqual([
148
+ {
149
+ message: '"foo" should be one of the predefined values',
150
+ location: baseLocation.child('foo').key(),
151
+ },
152
+ ]);
153
+ expect(asserts.enum('test', ['foo', 'example'], assertionProperties)).toEqual([
130
154
  {
131
155
  message: '"test" should be one of the predefined values',
132
156
  location: baseLocation,
133
157
  },
134
158
  ]);
135
- expect(asserts.enum(['test', 'foo'], ['test', 'example'], baseLocation)).toEqual([
159
+ expect(asserts.enum(['test', 'foo'], ['test', 'example'], assertionProperties)).toEqual([
136
160
  {
137
161
  message: '"foo" should be one of the predefined values',
138
162
  location: baseLocation.child('foo').key(),
@@ -143,8 +167,8 @@ describe('oas3 assertions', () => {
143
167
 
144
168
  describe('defined', () => {
145
169
  it('value should be defined', () => {
146
- expect(asserts.defined('test', true, baseLocation)).toEqual([]);
147
- expect(asserts.defined(undefined, true, baseLocation)).toEqual([
170
+ expect(asserts.defined('test', true, assertionProperties)).toEqual([]);
171
+ expect(asserts.defined(undefined, true, assertionProperties)).toEqual([
148
172
  {
149
173
  message: 'Should be defined',
150
174
  location: baseLocation,
@@ -152,8 +176,8 @@ describe('oas3 assertions', () => {
152
176
  ]);
153
177
  });
154
178
  it('value should be undefined', () => {
155
- expect(asserts.defined(undefined, false, baseLocation)).toEqual([]);
156
- expect(asserts.defined('test', false, baseLocation)).toEqual([
179
+ expect(asserts.defined(undefined, false, assertionProperties)).toEqual([]);
180
+ expect(asserts.defined('test', false, assertionProperties)).toEqual([
157
181
  {
158
182
  message: 'Should be not defined',
159
183
  location: baseLocation,
@@ -164,8 +188,8 @@ describe('oas3 assertions', () => {
164
188
 
165
189
  describe('undefined', () => {
166
190
  it('value should be undefined', () => {
167
- expect(asserts.undefined(undefined, true, baseLocation)).toEqual([]);
168
- expect(asserts.undefined('test', true, baseLocation)).toEqual([
191
+ expect(asserts.undefined(undefined, true, assertionProperties)).toEqual([]);
192
+ expect(asserts.undefined('test', true, assertionProperties)).toEqual([
169
193
  {
170
194
  message: 'Should not be defined',
171
195
  location: baseLocation,
@@ -173,8 +197,8 @@ describe('oas3 assertions', () => {
173
197
  ]);
174
198
  });
175
199
  it('value should be defined', () => {
176
- expect(asserts.undefined('test', false, baseLocation)).toEqual([]);
177
- expect(asserts.undefined(undefined, false, baseLocation)).toEqual([
200
+ expect(asserts.undefined('test', false, assertionProperties)).toEqual([]);
201
+ expect(asserts.undefined(undefined, false, assertionProperties)).toEqual([
178
202
  {
179
203
  message: 'Should be defined',
180
204
  location: baseLocation,
@@ -185,8 +209,12 @@ describe('oas3 assertions', () => {
185
209
 
186
210
  describe('required', () => {
187
211
  it('values should be required', () => {
188
- expect(asserts.required(['one', 'two', 'three'], ['one', 'two'], baseLocation)).toEqual([]);
189
- expect(asserts.required(['one', 'two'], ['one', 'two', 'three'], baseLocation)).toEqual([
212
+ expect(
213
+ asserts.required(['one', 'two', 'three'], ['one', 'two'], assertionProperties)
214
+ ).toEqual([]);
215
+ expect(
216
+ asserts.required(['one', 'two'], ['one', 'two', 'three'], assertionProperties)
217
+ ).toEqual([
190
218
  {
191
219
  message: 'three is required',
192
220
  location: baseLocation.key(),
@@ -197,20 +225,20 @@ describe('oas3 assertions', () => {
197
225
 
198
226
  describe('nonEmpty', () => {
199
227
  it('value should not be empty', () => {
200
- expect(asserts.nonEmpty('test', true, baseLocation)).toEqual([]);
201
- expect(asserts.nonEmpty('', true, baseLocation)).toEqual([
228
+ expect(asserts.nonEmpty('test', true, assertionProperties)).toEqual([]);
229
+ expect(asserts.nonEmpty('', true, assertionProperties)).toEqual([
202
230
  {
203
231
  message: 'Should not be empty',
204
232
  location: baseLocation,
205
233
  },
206
234
  ]);
207
- expect(asserts.nonEmpty(null, true, baseLocation)).toEqual([
235
+ expect(asserts.nonEmpty(null, true, assertionProperties)).toEqual([
208
236
  {
209
237
  message: 'Should not be empty',
210
238
  location: baseLocation,
211
239
  },
212
240
  ]);
213
- expect(asserts.nonEmpty(undefined, true, baseLocation)).toEqual([
241
+ expect(asserts.nonEmpty(undefined, true, assertionProperties)).toEqual([
214
242
  {
215
243
  message: 'Should not be empty',
216
244
  location: baseLocation,
@@ -218,10 +246,10 @@ describe('oas3 assertions', () => {
218
246
  ]);
219
247
  });
220
248
  it('value should be empty', () => {
221
- expect(asserts.nonEmpty('', false, baseLocation)).toEqual([]);
222
- expect(asserts.nonEmpty(null, false, baseLocation)).toEqual([]);
223
- expect(asserts.nonEmpty(undefined, false, baseLocation)).toEqual([]);
224
- expect(asserts.nonEmpty('test', false, baseLocation)).toEqual([
249
+ expect(asserts.nonEmpty('', false, assertionProperties)).toEqual([]);
250
+ expect(asserts.nonEmpty(null, false, assertionProperties)).toEqual([]);
251
+ expect(asserts.nonEmpty(undefined, false, assertionProperties)).toEqual([]);
252
+ expect(asserts.nonEmpty('test', false, assertionProperties)).toEqual([
225
253
  {
226
254
  message: 'Should be empty',
227
255
  location: baseLocation,
@@ -232,28 +260,28 @@ describe('oas3 assertions', () => {
232
260
 
233
261
  describe('minLength', () => {
234
262
  it('value should have less or equal than 5 symbols length', () => {
235
- expect(asserts.minLength('test', 5, baseLocation)).toEqual([
263
+ expect(asserts.minLength('test', 5, assertionProperties)).toEqual([
236
264
  {
237
265
  message: 'Should have at least 5 characters',
238
266
  location: baseLocation,
239
267
  },
240
268
  ]);
241
- expect(asserts.minLength([1, 2, 3, 4], 5, baseLocation)).toEqual([
269
+ expect(asserts.minLength([1, 2, 3, 4], 5, assertionProperties)).toEqual([
242
270
  {
243
271
  message: 'Should have at least 5 characters',
244
272
  location: baseLocation,
245
273
  },
246
274
  ]);
247
- expect(asserts.minLength([1, 2, 3, 4, 5], 5, baseLocation)).toEqual([]);
248
- expect(asserts.minLength([1, 2, 3, 4, 5, 6], 5, baseLocation)).toEqual([]);
249
- expect(asserts.minLength('example', 5, baseLocation)).toEqual([]);
250
- expect(asserts.minLength([], 5, baseLocation)).toEqual([
275
+ expect(asserts.minLength([1, 2, 3, 4, 5], 5, assertionProperties)).toEqual([]);
276
+ expect(asserts.minLength([1, 2, 3, 4, 5, 6], 5, assertionProperties)).toEqual([]);
277
+ expect(asserts.minLength('example', 5, assertionProperties)).toEqual([]);
278
+ expect(asserts.minLength([], 5, assertionProperties)).toEqual([
251
279
  {
252
280
  message: 'Should have at least 5 characters',
253
281
  location: baseLocation,
254
282
  },
255
283
  ]);
256
- expect(asserts.minLength('', 5, baseLocation)).toEqual([
284
+ expect(asserts.minLength('', 5, assertionProperties)).toEqual([
257
285
  {
258
286
  message: 'Should have at least 5 characters',
259
287
  location: baseLocation,
@@ -264,49 +292,53 @@ describe('oas3 assertions', () => {
264
292
 
265
293
  describe('maxLength', () => {
266
294
  it('value should have more or equal than 5 symbols length', () => {
267
- expect(asserts.maxLength('test', 5, baseLocation)).toEqual([]);
268
- expect(asserts.maxLength([1, 2, 3, 4], 5, baseLocation)).toEqual([]);
269
- expect(asserts.maxLength([1, 2, 3, 4, 5], 5, baseLocation)).toEqual([]);
270
- expect(asserts.maxLength([1, 2, 3, 4, 5, 6], 5, baseLocation)).toEqual([
295
+ expect(asserts.maxLength('test', 5, assertionProperties)).toEqual([]);
296
+ expect(asserts.maxLength([1, 2, 3, 4], 5, assertionProperties)).toEqual([]);
297
+ expect(asserts.maxLength([1, 2, 3, 4, 5], 5, assertionProperties)).toEqual([]);
298
+ expect(asserts.maxLength([1, 2, 3, 4, 5, 6], 5, assertionProperties)).toEqual([
271
299
  {
272
300
  message: 'Should have at most 5 characters',
273
301
  location: baseLocation,
274
302
  },
275
303
  ]);
276
- expect(asserts.maxLength('example', 5, baseLocation)).toEqual([
304
+ expect(asserts.maxLength('example', 5, assertionProperties)).toEqual([
277
305
  {
278
306
  message: 'Should have at most 5 characters',
279
307
  location: baseLocation,
280
308
  },
281
309
  ]);
282
- expect(asserts.maxLength([], 5, baseLocation)).toEqual([]);
283
- expect(asserts.maxLength('', 5, baseLocation)).toEqual([]);
310
+ expect(asserts.maxLength([], 5, assertionProperties)).toEqual([]);
311
+ expect(asserts.maxLength('', 5, assertionProperties)).toEqual([]);
284
312
  });
285
313
  });
286
314
 
287
315
  describe('casing', () => {
288
316
  it('value should be camelCase', () => {
289
- expect(asserts.casing(['testExample', 'fooBar'], 'camelCase', baseLocation)).toEqual([]);
290
- expect(asserts.casing(['testExample', 'FooBar'], 'camelCase', baseLocation)).toEqual([
291
- {
292
- message: '"FooBar" should use camelCase',
293
- location: baseLocation.child('FooBar').key(),
294
- },
295
- ]);
296
- expect(asserts.casing('testExample', 'camelCase', baseLocation)).toEqual([]);
297
- expect(asserts.casing('TestExample', 'camelCase', baseLocation)).toEqual([
317
+ expect(asserts.casing(['testExample', 'fooBar'], 'camelCase', assertionProperties)).toEqual(
318
+ []
319
+ );
320
+ expect(asserts.casing(['testExample', 'FooBar'], 'camelCase', assertionProperties)).toEqual(
321
+ [
322
+ {
323
+ message: '"FooBar" should use camelCase',
324
+ location: baseLocation.child('FooBar').key(),
325
+ },
326
+ ]
327
+ );
328
+ expect(asserts.casing('testExample', 'camelCase', assertionProperties)).toEqual([]);
329
+ expect(asserts.casing('TestExample', 'camelCase', assertionProperties)).toEqual([
298
330
  {
299
331
  message: '"TestExample" should use camelCase',
300
332
  location: baseLocation,
301
333
  },
302
334
  ]);
303
- expect(asserts.casing('test-example', 'camelCase', baseLocation)).toEqual([
335
+ expect(asserts.casing('test-example', 'camelCase', assertionProperties)).toEqual([
304
336
  {
305
337
  message: '"test-example" should use camelCase',
306
338
  location: baseLocation,
307
339
  },
308
340
  ]);
309
- expect(asserts.casing('test_example', 'camelCase', baseLocation)).toEqual([
341
+ expect(asserts.casing('test_example', 'camelCase', assertionProperties)).toEqual([
310
342
  {
311
343
  message: '"test_example" should use camelCase',
312
344
  location: baseLocation,
@@ -314,27 +346,31 @@ describe('oas3 assertions', () => {
314
346
  ]);
315
347
  });
316
348
  it('value should be PascalCase', () => {
317
- expect(asserts.casing('TestExample', 'PascalCase', baseLocation)).toEqual([]);
318
- expect(asserts.casing(['TestExample', 'FooBar'], 'PascalCase', baseLocation)).toEqual([]);
319
- expect(asserts.casing(['TestExample', 'fooBar'], 'PascalCase', baseLocation)).toEqual([
349
+ expect(asserts.casing('TestExample', 'PascalCase', assertionProperties)).toEqual([]);
350
+ expect(
351
+ asserts.casing(['TestExample', 'FooBar'], 'PascalCase', assertionProperties)
352
+ ).toEqual([]);
353
+ expect(
354
+ asserts.casing(['TestExample', 'fooBar'], 'PascalCase', assertionProperties)
355
+ ).toEqual([
320
356
  {
321
357
  message: '"fooBar" should use PascalCase',
322
358
  location: baseLocation.child('fooBar').key(),
323
359
  },
324
360
  ]);
325
- expect(asserts.casing('testExample', 'PascalCase', baseLocation)).toEqual([
361
+ expect(asserts.casing('testExample', 'PascalCase', assertionProperties)).toEqual([
326
362
  {
327
363
  message: '"testExample" should use PascalCase',
328
364
  location: baseLocation,
329
365
  },
330
366
  ]);
331
- expect(asserts.casing('test-example', 'PascalCase', baseLocation)).toEqual([
367
+ expect(asserts.casing('test-example', 'PascalCase', assertionProperties)).toEqual([
332
368
  {
333
369
  message: '"test-example" should use PascalCase',
334
370
  location: baseLocation,
335
371
  },
336
372
  ]);
337
- expect(asserts.casing('test_example', 'PascalCase', baseLocation)).toEqual([
373
+ expect(asserts.casing('test_example', 'PascalCase', assertionProperties)).toEqual([
338
374
  {
339
375
  message: '"test_example" should use PascalCase',
340
376
  location: baseLocation,
@@ -342,27 +378,31 @@ describe('oas3 assertions', () => {
342
378
  ]);
343
379
  });
344
380
  it('value should be kebab-case', () => {
345
- expect(asserts.casing('test-example', 'kebab-case', baseLocation)).toEqual([]);
346
- expect(asserts.casing(['test-example', 'foo-bar'], 'kebab-case', baseLocation)).toEqual([]);
347
- expect(asserts.casing(['test-example', 'foo_bar'], 'kebab-case', baseLocation)).toEqual([
381
+ expect(asserts.casing('test-example', 'kebab-case', assertionProperties)).toEqual([]);
382
+ expect(
383
+ asserts.casing(['test-example', 'foo-bar'], 'kebab-case', assertionProperties)
384
+ ).toEqual([]);
385
+ expect(
386
+ asserts.casing(['test-example', 'foo_bar'], 'kebab-case', assertionProperties)
387
+ ).toEqual([
348
388
  {
349
389
  message: '"foo_bar" should use kebab-case',
350
390
  location: baseLocation.child('foo_bar').key(),
351
391
  },
352
392
  ]);
353
- expect(asserts.casing('testExample', 'kebab-case', baseLocation)).toEqual([
393
+ expect(asserts.casing('testExample', 'kebab-case', assertionProperties)).toEqual([
354
394
  {
355
395
  message: '"testExample" should use kebab-case',
356
396
  location: baseLocation,
357
397
  },
358
398
  ]);
359
- expect(asserts.casing('TestExample', 'kebab-case', baseLocation)).toEqual([
399
+ expect(asserts.casing('TestExample', 'kebab-case', assertionProperties)).toEqual([
360
400
  {
361
401
  message: '"TestExample" should use kebab-case',
362
402
  location: baseLocation,
363
403
  },
364
404
  ]);
365
- expect(asserts.casing('test_example', 'kebab-case', baseLocation)).toEqual([
405
+ expect(asserts.casing('test_example', 'kebab-case', assertionProperties)).toEqual([
366
406
  {
367
407
  message: '"test_example" should use kebab-case',
368
408
  location: baseLocation,
@@ -370,27 +410,31 @@ describe('oas3 assertions', () => {
370
410
  ]);
371
411
  });
372
412
  it('value should be snake_case', () => {
373
- expect(asserts.casing('test_example', 'snake_case', baseLocation)).toEqual([]);
374
- expect(asserts.casing(['test_example', 'foo_bar'], 'snake_case', baseLocation)).toEqual([]);
375
- expect(asserts.casing(['test_example', 'foo-bar'], 'snake_case', baseLocation)).toEqual([
413
+ expect(asserts.casing('test_example', 'snake_case', assertionProperties)).toEqual([]);
414
+ expect(
415
+ asserts.casing(['test_example', 'foo_bar'], 'snake_case', assertionProperties)
416
+ ).toEqual([]);
417
+ expect(
418
+ asserts.casing(['test_example', 'foo-bar'], 'snake_case', assertionProperties)
419
+ ).toEqual([
376
420
  {
377
421
  message: '"foo-bar" should use snake_case',
378
422
  location: baseLocation.child('foo-bar').key(),
379
423
  },
380
424
  ]);
381
- expect(asserts.casing('testExample', 'snake_case', baseLocation)).toEqual([
425
+ expect(asserts.casing('testExample', 'snake_case', assertionProperties)).toEqual([
382
426
  {
383
427
  message: '"testExample" should use snake_case',
384
428
  location: baseLocation,
385
429
  },
386
430
  ]);
387
- expect(asserts.casing('TestExample', 'snake_case', baseLocation)).toEqual([
431
+ expect(asserts.casing('TestExample', 'snake_case', assertionProperties)).toEqual([
388
432
  {
389
433
  message: '"TestExample" should use snake_case',
390
434
  location: baseLocation,
391
435
  },
392
436
  ]);
393
- expect(asserts.casing('test-example', 'snake_case', baseLocation)).toEqual([
437
+ expect(asserts.casing('test-example', 'snake_case', assertionProperties)).toEqual([
394
438
  {
395
439
  message: '"test-example" should use snake_case',
396
440
  location: baseLocation,
@@ -398,51 +442,55 @@ describe('oas3 assertions', () => {
398
442
  ]);
399
443
  });
400
444
  it('value should be MACRO_CASE', () => {
401
- expect(asserts.casing('TEST_EXAMPLE', 'MACRO_CASE', baseLocation)).toEqual([]);
402
- expect(asserts.casing(['TEST_EXAMPLE', 'FOO_BAR'], 'MACRO_CASE', baseLocation)).toEqual([]);
403
- expect(asserts.casing(['TEST_EXAMPLE', 'FOO-BAR'], 'MACRO_CASE', baseLocation)).toEqual([
445
+ expect(asserts.casing('TEST_EXAMPLE', 'MACRO_CASE', assertionProperties)).toEqual([]);
446
+ expect(
447
+ asserts.casing(['TEST_EXAMPLE', 'FOO_BAR'], 'MACRO_CASE', assertionProperties)
448
+ ).toEqual([]);
449
+ expect(
450
+ asserts.casing(['TEST_EXAMPLE', 'FOO-BAR'], 'MACRO_CASE', assertionProperties)
451
+ ).toEqual([
404
452
  {
405
453
  message: '"FOO-BAR" should use MACRO_CASE',
406
454
  location: baseLocation.child('FOO-BAR').key(),
407
455
  },
408
456
  ]);
409
- expect(asserts.casing('TEST_EXAMPLE_', 'MACRO_CASE', baseLocation)).toEqual([
457
+ expect(asserts.casing('TEST_EXAMPLE_', 'MACRO_CASE', assertionProperties)).toEqual([
410
458
  {
411
459
  message: '"TEST_EXAMPLE_" should use MACRO_CASE',
412
460
  location: baseLocation,
413
461
  },
414
462
  ]);
415
- expect(asserts.casing('_TEST_EXAMPLE', 'MACRO_CASE', baseLocation)).toEqual([
463
+ expect(asserts.casing('_TEST_EXAMPLE', 'MACRO_CASE', assertionProperties)).toEqual([
416
464
  {
417
465
  message: '"_TEST_EXAMPLE" should use MACRO_CASE',
418
466
  location: baseLocation,
419
467
  },
420
468
  ]);
421
- expect(asserts.casing('TEST__EXAMPLE', 'MACRO_CASE', baseLocation)).toEqual([
469
+ expect(asserts.casing('TEST__EXAMPLE', 'MACRO_CASE', assertionProperties)).toEqual([
422
470
  {
423
471
  message: '"TEST__EXAMPLE" should use MACRO_CASE',
424
472
  location: baseLocation,
425
473
  },
426
474
  ]);
427
- expect(asserts.casing('TEST-EXAMPLE', 'MACRO_CASE', baseLocation)).toEqual([
475
+ expect(asserts.casing('TEST-EXAMPLE', 'MACRO_CASE', assertionProperties)).toEqual([
428
476
  {
429
477
  message: '"TEST-EXAMPLE" should use MACRO_CASE',
430
478
  location: baseLocation,
431
479
  },
432
480
  ]);
433
- expect(asserts.casing('testExample', 'MACRO_CASE', baseLocation)).toEqual([
481
+ expect(asserts.casing('testExample', 'MACRO_CASE', assertionProperties)).toEqual([
434
482
  {
435
483
  message: '"testExample" should use MACRO_CASE',
436
484
  location: baseLocation,
437
485
  },
438
486
  ]);
439
- expect(asserts.casing('TestExample', 'MACRO_CASE', baseLocation)).toEqual([
487
+ expect(asserts.casing('TestExample', 'MACRO_CASE', assertionProperties)).toEqual([
440
488
  {
441
489
  message: '"TestExample" should use MACRO_CASE',
442
490
  location: baseLocation,
443
491
  },
444
492
  ]);
445
- expect(asserts.casing('test-example', 'MACRO_CASE', baseLocation)).toEqual([
493
+ expect(asserts.casing('test-example', 'MACRO_CASE', assertionProperties)).toEqual([
446
494
  {
447
495
  message: '"test-example" should use MACRO_CASE',
448
496
  location: baseLocation,
@@ -450,57 +498,61 @@ describe('oas3 assertions', () => {
450
498
  ]);
451
499
  });
452
500
  it('value should be COBOL-CASE', () => {
453
- expect(asserts.casing('TEST-EXAMPLE', 'COBOL-CASE', baseLocation)).toEqual([]);
454
- expect(asserts.casing(['TEST-EXAMPLE', 'FOO-BAR'], 'COBOL-CASE', baseLocation)).toEqual([]);
455
- expect(asserts.casing(['TEST-EXAMPLE', 'FOO_BAR'], 'COBOL-CASE', baseLocation)).toEqual([
501
+ expect(asserts.casing('TEST-EXAMPLE', 'COBOL-CASE', assertionProperties)).toEqual([]);
502
+ expect(
503
+ asserts.casing(['TEST-EXAMPLE', 'FOO-BAR'], 'COBOL-CASE', assertionProperties)
504
+ ).toEqual([]);
505
+ expect(
506
+ asserts.casing(['TEST-EXAMPLE', 'FOO_BAR'], 'COBOL-CASE', assertionProperties)
507
+ ).toEqual([
456
508
  {
457
509
  message: '"FOO_BAR" should use COBOL-CASE',
458
510
  location: baseLocation.child('FOO_BAR').key(),
459
511
  },
460
512
  ]);
461
- expect(asserts.casing('TEST-EXAMPLE-', 'COBOL-CASE', baseLocation)).toEqual([
513
+ expect(asserts.casing('TEST-EXAMPLE-', 'COBOL-CASE', assertionProperties)).toEqual([
462
514
  {
463
515
  message: '"TEST-EXAMPLE-" should use COBOL-CASE',
464
516
  location: baseLocation,
465
517
  },
466
518
  ]);
467
- expect(asserts.casing('0TEST-EXAMPLE', 'COBOL-CASE', baseLocation)).toEqual([
519
+ expect(asserts.casing('0TEST-EXAMPLE', 'COBOL-CASE', assertionProperties)).toEqual([
468
520
  {
469
521
  message: '"0TEST-EXAMPLE" should use COBOL-CASE',
470
522
  location: baseLocation,
471
523
  },
472
524
  ]);
473
- expect(asserts.casing('-TEST-EXAMPLE', 'COBOL-CASE', baseLocation)).toEqual([
525
+ expect(asserts.casing('-TEST-EXAMPLE', 'COBOL-CASE', assertionProperties)).toEqual([
474
526
  {
475
527
  message: '"-TEST-EXAMPLE" should use COBOL-CASE',
476
528
  location: baseLocation,
477
529
  },
478
530
  ]);
479
- expect(asserts.casing('TEST--EXAMPLE', 'COBOL-CASE', baseLocation)).toEqual([
531
+ expect(asserts.casing('TEST--EXAMPLE', 'COBOL-CASE', assertionProperties)).toEqual([
480
532
  {
481
533
  message: '"TEST--EXAMPLE" should use COBOL-CASE',
482
534
  location: baseLocation,
483
535
  },
484
536
  ]);
485
- expect(asserts.casing('TEST_EXAMPLE', 'COBOL-CASE', baseLocation)).toEqual([
537
+ expect(asserts.casing('TEST_EXAMPLE', 'COBOL-CASE', assertionProperties)).toEqual([
486
538
  {
487
539
  message: '"TEST_EXAMPLE" should use COBOL-CASE',
488
540
  location: baseLocation,
489
541
  },
490
542
  ]);
491
- expect(asserts.casing('testExample', 'COBOL-CASE', baseLocation)).toEqual([
543
+ expect(asserts.casing('testExample', 'COBOL-CASE', assertionProperties)).toEqual([
492
544
  {
493
545
  message: '"testExample" should use COBOL-CASE',
494
546
  location: baseLocation,
495
547
  },
496
548
  ]);
497
- expect(asserts.casing('TestExample', 'COBOL-CASE', baseLocation)).toEqual([
549
+ expect(asserts.casing('TestExample', 'COBOL-CASE', assertionProperties)).toEqual([
498
550
  {
499
551
  message: '"TestExample" should use COBOL-CASE',
500
552
  location: baseLocation,
501
553
  },
502
554
  ]);
503
- expect(asserts.casing('test-example', 'COBOL-CASE', baseLocation)).toEqual([
555
+ expect(asserts.casing('test-example', 'COBOL-CASE', assertionProperties)).toEqual([
504
556
  {
505
557
  message: '"test-example" should use COBOL-CASE',
506
558
  location: baseLocation,
@@ -508,39 +560,43 @@ describe('oas3 assertions', () => {
508
560
  ]);
509
561
  });
510
562
  it('value should be flatcase', () => {
511
- expect(asserts.casing('testexample', 'flatcase', baseLocation)).toEqual([]);
512
- expect(asserts.casing(['testexample', 'foobar'], 'flatcase', baseLocation)).toEqual([]);
513
- expect(asserts.casing(['testexample', 'foo_bar'], 'flatcase', baseLocation)).toEqual([
514
- {
515
- message: '"foo_bar" should use flatcase',
516
- location: baseLocation.child('foo_bar').key(),
517
- },
518
- ]);
519
- expect(asserts.casing('testexample_', 'flatcase', baseLocation)).toEqual([
563
+ expect(asserts.casing('testexample', 'flatcase', assertionProperties)).toEqual([]);
564
+ expect(asserts.casing(['testexample', 'foobar'], 'flatcase', assertionProperties)).toEqual(
565
+ []
566
+ );
567
+ expect(asserts.casing(['testexample', 'foo_bar'], 'flatcase', assertionProperties)).toEqual(
568
+ [
569
+ {
570
+ message: '"foo_bar" should use flatcase',
571
+ location: baseLocation.child('foo_bar').key(),
572
+ },
573
+ ]
574
+ );
575
+ expect(asserts.casing('testexample_', 'flatcase', assertionProperties)).toEqual([
520
576
  {
521
577
  message: '"testexample_" should use flatcase',
522
578
  location: baseLocation,
523
579
  },
524
580
  ]);
525
- expect(asserts.casing('0testexample', 'flatcase', baseLocation)).toEqual([
581
+ expect(asserts.casing('0testexample', 'flatcase', assertionProperties)).toEqual([
526
582
  {
527
583
  message: '"0testexample" should use flatcase',
528
584
  location: baseLocation,
529
585
  },
530
586
  ]);
531
- expect(asserts.casing('testExample', 'flatcase', baseLocation)).toEqual([
587
+ expect(asserts.casing('testExample', 'flatcase', assertionProperties)).toEqual([
532
588
  {
533
589
  message: '"testExample" should use flatcase',
534
590
  location: baseLocation,
535
591
  },
536
592
  ]);
537
- expect(asserts.casing('TestExample', 'flatcase', baseLocation)).toEqual([
593
+ expect(asserts.casing('TestExample', 'flatcase', assertionProperties)).toEqual([
538
594
  {
539
595
  message: '"TestExample" should use flatcase',
540
596
  location: baseLocation,
541
597
  },
542
598
  ]);
543
- expect(asserts.casing('test-example', 'flatcase', baseLocation)).toEqual([
599
+ expect(asserts.casing('test-example', 'flatcase', assertionProperties)).toEqual([
544
600
  {
545
601
  message: '"test-example" should use flatcase',
546
602
  location: baseLocation,
@@ -551,18 +607,20 @@ describe('oas3 assertions', () => {
551
607
 
552
608
  describe('sortOrder', () => {
553
609
  it('value should be ordered in ASC direction', () => {
554
- expect(asserts.sortOrder(['example', 'foo', 'test'], 'asc', baseLocation)).toEqual([]);
610
+ expect(asserts.sortOrder(['example', 'foo', 'test'], 'asc', assertionProperties)).toEqual(
611
+ []
612
+ );
555
613
  expect(
556
- asserts.sortOrder(['example', 'foo', 'test'], { direction: 'asc' }, baseLocation)
614
+ asserts.sortOrder(['example', 'foo', 'test'], { direction: 'asc' }, assertionProperties)
557
615
  ).toEqual([]);
558
- expect(asserts.sortOrder(['example'], 'asc', baseLocation)).toEqual([]);
559
- expect(asserts.sortOrder(['example', 'test', 'foo'], 'asc', baseLocation)).toEqual([
616
+ expect(asserts.sortOrder(['example'], 'asc', assertionProperties)).toEqual([]);
617
+ expect(asserts.sortOrder(['example', 'test', 'foo'], 'asc', assertionProperties)).toEqual([
560
618
  {
561
619
  message: 'Should be sorted in an ascending order',
562
620
  location: baseLocation,
563
621
  },
564
622
  ]);
565
- expect(asserts.sortOrder(['example', 'foo', 'test'], 'desc', baseLocation)).toEqual([
623
+ expect(asserts.sortOrder(['example', 'foo', 'test'], 'desc', assertionProperties)).toEqual([
566
624
  {
567
625
  message: 'Should be sorted in a descending order',
568
626
  location: baseLocation,
@@ -572,14 +630,14 @@ describe('oas3 assertions', () => {
572
630
  asserts.sortOrder(
573
631
  [{ name: 'bar' }, { name: 'baz' }, { name: 'foo' }],
574
632
  { direction: 'asc', property: 'name' },
575
- baseLocation
633
+ assertionProperties
576
634
  )
577
635
  ).toEqual([]);
578
636
  expect(
579
637
  asserts.sortOrder(
580
638
  [{ name: 'bar' }, { name: 'baz' }, { name: 'foo' }],
581
639
  { direction: 'desc', property: 'name' },
582
- baseLocation
640
+ assertionProperties
583
641
  )
584
642
  ).toEqual([
585
643
  {
@@ -589,18 +647,20 @@ describe('oas3 assertions', () => {
589
647
  ]);
590
648
  });
591
649
  it('value should be ordered in DESC direction', () => {
592
- expect(asserts.sortOrder(['test', 'foo', 'example'], 'desc', baseLocation)).toEqual([]);
650
+ expect(asserts.sortOrder(['test', 'foo', 'example'], 'desc', assertionProperties)).toEqual(
651
+ []
652
+ );
593
653
  expect(
594
- asserts.sortOrder(['test', 'foo', 'example'], { direction: 'desc' }, baseLocation)
654
+ asserts.sortOrder(['test', 'foo', 'example'], { direction: 'desc' }, assertionProperties)
595
655
  ).toEqual([]);
596
- expect(asserts.sortOrder(['example'], 'desc', baseLocation)).toEqual([]);
597
- expect(asserts.sortOrder(['example', 'test', 'foo'], 'desc', baseLocation)).toEqual([
656
+ expect(asserts.sortOrder(['example'], 'desc', assertionProperties)).toEqual([]);
657
+ expect(asserts.sortOrder(['example', 'test', 'foo'], 'desc', assertionProperties)).toEqual([
598
658
  {
599
659
  message: 'Should be sorted in a descending order',
600
660
  location: baseLocation,
601
661
  },
602
662
  ]);
603
- expect(asserts.sortOrder(['test', 'foo', 'example'], 'asc', baseLocation)).toEqual([
663
+ expect(asserts.sortOrder(['test', 'foo', 'example'], 'asc', assertionProperties)).toEqual([
604
664
  {
605
665
  message: 'Should be sorted in an ascending order',
606
666
  location: baseLocation,
@@ -610,14 +670,14 @@ describe('oas3 assertions', () => {
610
670
  asserts.sortOrder(
611
671
  [{ name: 'foo' }, { name: 'baz' }, { name: 'bar' }],
612
672
  { direction: 'desc', property: 'name' },
613
- baseLocation
673
+ assertionProperties
614
674
  )
615
675
  ).toEqual([]);
616
676
  expect(
617
677
  asserts.sortOrder(
618
678
  [{ name: 'foo' }, { name: 'baz' }, { name: 'bar' }],
619
679
  { direction: 'asc', property: 'name' },
620
- baseLocation
680
+ assertionProperties
621
681
  )
622
682
  ).toEqual([
623
683
  {
@@ -635,7 +695,7 @@ describe('oas3 assertions', () => {
635
695
  { name: 'foo', id: 3 },
636
696
  ],
637
697
  { direction: 'desc' },
638
- baseLocation
698
+ assertionProperties
639
699
  )
640
700
  ).toEqual([
641
701
  {
@@ -651,7 +711,7 @@ describe('oas3 assertions', () => {
651
711
  { name: 'foo', id: 3 },
652
712
  ],
653
713
  { direction: 'asc' },
654
- baseLocation
714
+ assertionProperties
655
715
  )
656
716
  ).toEqual([
657
717
  {
@@ -661,20 +721,24 @@ describe('oas3 assertions', () => {
661
721
  ]);
662
722
  });
663
723
  it('should ignore string value casing while ordering', () => {
664
- expect(asserts.sortOrder(['Example', 'foo', 'Test'], 'asc', baseLocation)).toEqual([]);
665
- expect(asserts.sortOrder(['Test', 'foo', 'Example'], 'desc', baseLocation)).toEqual([]);
724
+ expect(asserts.sortOrder(['Example', 'foo', 'Test'], 'asc', assertionProperties)).toEqual(
725
+ []
726
+ );
727
+ expect(asserts.sortOrder(['Test', 'foo', 'Example'], 'desc', assertionProperties)).toEqual(
728
+ []
729
+ );
666
730
  expect(
667
731
  asserts.sortOrder(
668
732
  [{ name: 'bar' }, { name: 'Baz' }, { name: 'Foo' }],
669
733
  { direction: 'asc', property: 'name' },
670
- baseLocation
734
+ assertionProperties
671
735
  )
672
736
  ).toEqual([]);
673
737
  expect(
674
738
  asserts.sortOrder(
675
739
  [{ name: 'Foo' }, { name: 'baz' }, { name: 'Bar' }],
676
740
  { direction: 'desc', property: 'name' },
677
- baseLocation
741
+ assertionProperties
678
742
  )
679
743
  ).toEqual([]);
680
744
  });
@@ -683,16 +747,22 @@ describe('oas3 assertions', () => {
683
747
  describe('mutuallyExclusive', () => {
684
748
  it('node should not have more than one property from predefined list', () => {
685
749
  expect(
686
- asserts.mutuallyExclusive(Object.keys(fakeNode), ['foo', 'test'], baseLocation)
750
+ asserts.mutuallyExclusive(Object.keys(fakeNode), ['foo', 'test'], assertionProperties)
687
751
  ).toEqual([]);
688
- expect(asserts.mutuallyExclusive(Object.keys(fakeNode), [], baseLocation)).toEqual([]);
752
+ expect(asserts.mutuallyExclusive(Object.keys(fakeNode), [], assertionProperties)).toEqual(
753
+ []
754
+ );
689
755
  expect(
690
- asserts.mutuallyExclusive(Object.keys(fakeNode), ['foo', 'bar'], baseLocation)
756
+ asserts.mutuallyExclusive(Object.keys(fakeNode), ['foo', 'bar'], assertionProperties)
691
757
  ).toEqual([
692
758
  { message: 'foo, bar keys should be mutually exclusive', location: baseLocation.key() },
693
759
  ]);
694
760
  expect(
695
- asserts.mutuallyExclusive(Object.keys(fakeNode), ['foo', 'bar', 'test'], baseLocation)
761
+ asserts.mutuallyExclusive(
762
+ Object.keys(fakeNode),
763
+ ['foo', 'bar', 'test'],
764
+ assertionProperties
765
+ )
696
766
  ).toEqual([
697
767
  {
698
768
  message: 'foo, bar, test keys should be mutually exclusive',
@@ -705,19 +775,29 @@ describe('oas3 assertions', () => {
705
775
  describe('mutuallyRequired', () => {
706
776
  it('node should have all the properties from predefined list', () => {
707
777
  expect(
708
- asserts.mutuallyRequired(Object.keys(fakeNode), ['foo', 'bar'], baseLocation)
778
+ asserts.mutuallyRequired(Object.keys(fakeNode), ['foo', 'bar'], assertionProperties)
709
779
  ).toEqual([]);
710
780
  expect(
711
- asserts.mutuallyRequired(Object.keys(fakeNode), ['foo', 'bar', 'baz'], baseLocation)
781
+ asserts.mutuallyRequired(
782
+ Object.keys(fakeNode),
783
+ ['foo', 'bar', 'baz'],
784
+ assertionProperties
785
+ )
712
786
  ).toEqual([]);
713
- expect(asserts.mutuallyRequired(Object.keys(fakeNode), [], baseLocation)).toEqual([]);
787
+ expect(asserts.mutuallyRequired(Object.keys(fakeNode), [], assertionProperties)).toEqual(
788
+ []
789
+ );
714
790
  expect(
715
- asserts.mutuallyRequired(Object.keys(fakeNode), ['foo', 'test'], baseLocation)
791
+ asserts.mutuallyRequired(Object.keys(fakeNode), ['foo', 'test'], assertionProperties)
716
792
  ).toEqual([
717
793
  { message: 'Properties foo, test are mutually required', location: baseLocation.key() },
718
794
  ]);
719
795
  expect(
720
- asserts.mutuallyRequired(Object.keys(fakeNode), ['foo', 'bar', 'test'], baseLocation)
796
+ asserts.mutuallyRequired(
797
+ Object.keys(fakeNode),
798
+ ['foo', 'bar', 'test'],
799
+ assertionProperties
800
+ )
721
801
  ).toEqual([
722
802
  {
723
803
  message: 'Properties foo, bar, test are mutually required',
@@ -729,36 +809,42 @@ describe('oas3 assertions', () => {
729
809
 
730
810
  describe('requireAny', () => {
731
811
  it('node must have at least one property from predefined list', () => {
732
- expect(asserts.requireAny(Object.keys(fakeNode), ['foo', 'test'], baseLocation)).toEqual(
733
- []
734
- );
735
- expect(asserts.requireAny(Object.keys(fakeNode), ['test', 'bar'], baseLocation)).toEqual(
736
- []
737
- );
738
- expect(asserts.requireAny(Object.keys(fakeNode), [], baseLocation)).toEqual([
812
+ expect(
813
+ asserts.requireAny(Object.keys(fakeNode), ['foo', 'test'], assertionProperties)
814
+ ).toEqual([]);
815
+ expect(
816
+ asserts.requireAny(Object.keys(fakeNode), ['test', 'bar'], assertionProperties)
817
+ ).toEqual([]);
818
+ expect(asserts.requireAny(Object.keys(fakeNode), [], assertionProperties)).toEqual([
739
819
  {
740
820
  message: 'Should have any of ',
741
821
  location: baseLocation.key(),
742
822
  },
743
823
  ]);
744
- expect(asserts.requireAny(Object.keys(fakeNode), ['test', 'test1'], baseLocation)).toEqual([
824
+ expect(
825
+ asserts.requireAny(Object.keys(fakeNode), ['test', 'test1'], assertionProperties)
826
+ ).toEqual([
745
827
  {
746
828
  message: 'Should have any of test, test1',
747
829
  location: baseLocation.key(),
748
830
  },
749
831
  ]);
750
- expect(asserts.requireAny(Object.keys(fakeNode), ['foo', 'bar'], baseLocation)).toEqual([]);
751
832
  expect(
752
- asserts.requireAny(Object.keys(fakeNode), ['foo', 'bar', 'test'], baseLocation)
833
+ asserts.requireAny(Object.keys(fakeNode), ['foo', 'bar'], assertionProperties)
834
+ ).toEqual([]);
835
+ expect(
836
+ asserts.requireAny(Object.keys(fakeNode), ['foo', 'bar', 'test'], assertionProperties)
753
837
  ).toEqual([]);
754
838
  });
755
839
  });
756
840
 
757
841
  describe('function', () => {
758
842
  it('node must have at least one property from predefined list', () => {
759
- const customFn = jest.fn((value: string[], options: any, location: Location) => {
843
+ const customFn = jest.fn((value: string[], options: any) => {
760
844
  if (value[0] === options.word) {
761
- return [{ message: `First value should be ${options.word}`, location: location.key() }];
845
+ return [
846
+ { message: `First value should be ${options.word}`, location: baseLocation.key() },
847
+ ];
762
848
  }
763
849
  return [];
764
850
  });
@@ -767,7 +853,7 @@ describe('oas3 assertions', () => {
767
853
  asserts['local/customFn' as keyof Asserts](
768
854
  Object.keys(fakeNode),
769
855
  { word: 'foo' },
770
- baseLocation
856
+ assertionProperties
771
857
  )
772
858
  ).toEqual([
773
859
  {