shinkansen-transmission 2.1.15 → 2.2.2

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.
Files changed (82) hide show
  1. package/.husky/pre-commit +4 -0
  2. package/babel.config.js +1 -1
  3. package/index.js +6 -1
  4. package/lib/index.js +1 -1
  5. package/lib/transmission/common/index.js +1 -1
  6. package/lib/transmission/from-document-to-hash/index.js +1 -1
  7. package/lib/transmission/from-hash-to-document/index.js +1 -1
  8. package/lib/transmission/index.js +1 -1
  9. package/lib/transmission/to-zashiki/index.js +1 -1
  10. package/lib/transmission/to-zashiki/transform-root-schema.js +1 -1
  11. package/lib/transmission/to-zashiki/transform-schema.js +1 -1
  12. package/package.json +23 -30
  13. package/src/transmission/from-document-to-hash/index.js +75 -29
  14. package/src/transmission/from-hash-to-document/index.js +13 -10
  15. package/src/transmission/to-zashiki/transform-root-schema.js +143 -136
  16. package/src/transmission/to-zashiki/transform-schema.js +3256 -1952
  17. package/.github/dependabot.yml +0 -9
  18. package/test/transmission/common/index.spec.js +0 -1348
  19. package/test/transmission/from-document-to-hash/index.spec.js +0 -1866
  20. package/test/transmission/from-hash-to-document/index.spec.js +0 -1523
  21. package/test/transmission/to-zashiki/transform-root-schema/transforming-array-type-schemas.spec.js +0 -1784
  22. package/test/transmission/to-zashiki/transform-root-schema/transforming-boolean-type-schemas.spec.js +0 -334
  23. package/test/transmission/to-zashiki/transform-root-schema/transforming-null-type-schemas.spec.js +0 -253
  24. package/test/transmission/to-zashiki/transform-root-schema/transforming-number-type-schemas.spec.js +0 -565
  25. package/test/transmission/to-zashiki/transform-root-schema/transforming-object-type-schemas.spec.js +0 -1715
  26. package/test/transmission/to-zashiki/transform-root-schema/transforming-string-type-schemas.spec.js +0 -496
  27. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-array-type-schemas.spec.js +0 -31633
  28. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-boolean-type-schemas.spec.js +0 -359
  29. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-null-type-schemas.spec.js +0 -359
  30. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-number-type-schemas.spec.js +0 -446
  31. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-object-type-schemas.spec.js +0 -8348
  32. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-string-type-schemas.spec.js +0 -446
  33. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-array-type-schemas.spec.js +0 -30373
  34. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-boolean-type-schemas.spec.js +0 -334
  35. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-null-type-schemas.spec.js +0 -253
  36. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-number-type-schemas.spec.js +0 -421
  37. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-object-type-schemas.spec.js +0 -7826
  38. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-string-type-schemas.spec.js +0 -421
  39. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-array-type-schemas.spec.js +0 -31111
  40. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-boolean-type-schemas.spec.js +0 -347
  41. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-null-type-schemas.spec.js +0 -344
  42. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-number-type-schemas.spec.js +0 -434
  43. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-object-type-schemas.spec.js +0 -8222
  44. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-string-type-schemas.spec.js +0 -434
  45. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-array-type-schemas.spec.js +0 -29494
  46. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-boolean-type-schemas.spec.js +0 -312
  47. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-null-type-schemas.spec.js +0 -309
  48. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-number-type-schemas.spec.js +0 -399
  49. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-object-type-schemas.spec.js +0 -7584
  50. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-string-type-schemas.spec.js +0 -398
  51. package/test/transmission/to-zashiki/transform-root-schema.spec.js +0 -22
  52. package/test/transmission/to-zashiki/transform-schema/transforming-array-type-schemas.spec.js +0 -1806
  53. package/test/transmission/to-zashiki/transform-schema/transforming-boolean-type-schemas.spec.js +0 -340
  54. package/test/transmission/to-zashiki/transform-schema/transforming-null-type-schemas.spec.js +0 -259
  55. package/test/transmission/to-zashiki/transform-schema/transforming-number-type-schemas.spec.js +0 -571
  56. package/test/transmission/to-zashiki/transform-schema/transforming-object-type-schemas.spec.js +0 -1737
  57. package/test/transmission/to-zashiki/transform-schema/transforming-string-type-schemas.spec.js +0 -502
  58. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-array-type-schemas.spec.js +0 -32173
  59. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-boolean-type-schemas.spec.js +0 -377
  60. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-null-type-schemas.spec.js +0 -377
  61. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-number-type-schemas.spec.js +0 -464
  62. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-object-type-schemas.spec.js +0 -8525
  63. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-string-type-schemas.spec.js +0 -464
  64. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-array-type-schemas.spec.js +0 -30910
  65. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-boolean-type-schemas.spec.js +0 -352
  66. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-null-type-schemas.spec.js +0 -271
  67. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-number-type-schemas.spec.js +0 -439
  68. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-object-type-schemas.spec.js +0 -8003
  69. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-string-type-schemas.spec.js +0 -439
  70. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-array-type-schemas.spec.js +0 -31654
  71. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-boolean-type-schemas.spec.js +0 -365
  72. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-null-type-schemas.spec.js +0 -362
  73. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-number-type-schemas.spec.js +0 -452
  74. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-object-type-schemas.spec.js +0 -8399
  75. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-string-type-schemas.spec.js +0 -452
  76. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-array-type-schemas.spec.js +0 -29671
  77. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-boolean-type-schemas.spec.js +0 -320
  78. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-null-type-schemas.spec.js +0 -317
  79. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-number-type-schemas.spec.js +0 -407
  80. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-object-type-schemas.spec.js +0 -7645
  81. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-string-type-schemas.spec.js +0 -406
  82. package/test/transmission/to-zashiki/transform-schema.spec.js +0 -777
@@ -1,1348 +0,0 @@
1
- import debug from 'debug'
2
-
3
- import { expect } from 'chai'
4
-
5
- import {
6
- getSelectedItems,
7
- getMetaProps,
8
- getMetaDefaultValue,
9
- getMetaValue,
10
- getElementsTitleProps,
11
- getElementsDescriptionProps,
12
- getElementsFieldProps,
13
- getElementsFieldValue,
14
- getMin,
15
- getMax,
16
- getMinLength,
17
- getMaxLength,
18
- getMinItems,
19
- getMaxItems,
20
- getHasUniqueItems,
21
- getMinContains,
22
- getMaxContains,
23
- getMinProperties,
24
- getMaxProperties,
25
- getIsExclusiveMin,
26
- getIsExclusiveMax,
27
- getStep,
28
- isObject,
29
- isArray,
30
- toConstValue,
31
- isConstValue,
32
- toDefaultValue,
33
- isDefaultValue,
34
- getTitle,
35
- getDescription,
36
- getIsReadOnly,
37
- getIsWriteOnly,
38
- hasEnum,
39
- getEnum,
40
- hasConst,
41
- getConst,
42
- hasDefault,
43
- getDefault,
44
- hasAnyOf,
45
- getAnyOf,
46
- hasOneOf,
47
- getOneOf,
48
- hasAllOf,
49
- getAllOf,
50
- getUri,
51
- getPattern
52
- } from 'shinkansen-transmission/transmission/common'
53
-
54
- describe('shinkansen-transmission/transmission/common', () => {
55
- before(() => {
56
- const {
57
- env: {
58
- DEBUG
59
- }
60
- } = process
61
-
62
- if (DEBUG) debug.enable(DEBUG)
63
- })
64
-
65
- describe('`getSelectedItems`', () => {
66
- it('is a function', () => {
67
- expect(getSelectedItems)
68
- .to.be.a('function')
69
- })
70
- })
71
-
72
- describe('`getMetaProps`', () => {
73
- it('is a function', () => {
74
- expect(getMetaProps)
75
- .to.be.a('function')
76
- })
77
- })
78
-
79
- describe('`getMetaDefaultValue`', () => {
80
- it('is a function', () => {
81
- expect(getMetaDefaultValue)
82
- .to.be.a('function')
83
- })
84
- })
85
-
86
- describe('`getMetaValue`', () => {
87
- it('is a function', () => {
88
- expect(getMetaValue)
89
- .to.be.a('function')
90
- })
91
- })
92
-
93
- describe('`getElementsTitleProps`', () => {
94
- it('is a function', () => {
95
- expect(getElementsTitleProps)
96
- .to.be.a('function')
97
- })
98
- })
99
-
100
- describe('`getElementsDescriptionProps`', () => {
101
- it('is a function', () => {
102
- expect(getElementsDescriptionProps)
103
- .to.be.a('function')
104
- })
105
- })
106
-
107
- describe('`getElementsFieldProps`', () => {
108
- it('is a function', () => {
109
- expect(getElementsFieldProps)
110
- .to.be.a('function')
111
- })
112
- })
113
-
114
- describe('`getElementsFieldValue`', () => {
115
- it('is a function', () => {
116
- expect(getElementsFieldValue)
117
- .to.be.a('function')
118
- })
119
- })
120
-
121
- describe('`getMin`', () => {
122
- it('is a function', () => {
123
- expect(getMin)
124
- .to.be.a('function')
125
- })
126
- })
127
-
128
- describe('`getMax`', () => {
129
- it('is a function', () => {
130
- expect(getMax)
131
- .to.be.a('function')
132
- })
133
- })
134
-
135
- describe('`getMinLength`', () => {
136
- it('is a function', () => {
137
- expect(getMinLength)
138
- .to.be.a('function')
139
- })
140
- })
141
-
142
- describe('`getMaxLength`', () => {
143
- it('is a function', () => {
144
- expect(getMaxLength)
145
- .to.be.a('function')
146
- })
147
- })
148
-
149
- describe('`getMinItems`', () => {
150
- it('is a function', () => {
151
- expect(getMinItems)
152
- .to.be.a('function')
153
- })
154
- })
155
-
156
- describe('`getMaxItems`', () => {
157
- it('is a function', () => {
158
- expect(getMaxItems)
159
- .to.be.a('function')
160
- })
161
- })
162
-
163
- describe('`getHasUniqueItems`', () => {
164
- it('is a function', () => {
165
- expect(getHasUniqueItems)
166
- .to.be.a('function')
167
- })
168
- })
169
-
170
- describe('`getMinContains`', () => {
171
- it('is a function', () => {
172
- expect(getMinContains)
173
- .to.be.a('function')
174
- })
175
- })
176
-
177
- describe('`getMaxContains`', () => {
178
- it('is a function', () => {
179
- expect(getMaxContains)
180
- .to.be.a('function')
181
- })
182
- })
183
-
184
- describe('`getMinProperties`', () => {
185
- it('is a function', () => {
186
- expect(getMinProperties)
187
- .to.be.a('function')
188
- })
189
- })
190
-
191
- describe('`getMaxProperties`', () => {
192
- it('is a function', () => {
193
- expect(getMaxProperties)
194
- .to.be.a('function')
195
- })
196
- })
197
-
198
- describe('`getIsExclusiveMin`', () => {
199
- it('is a function', () => {
200
- expect(getIsExclusiveMin)
201
- .to.be.a('function')
202
- })
203
- })
204
-
205
- describe('`getIsExclusiveMax`', () => {
206
- it('is a function', () => {
207
- expect(getIsExclusiveMax)
208
- .to.be.a('function')
209
- })
210
- })
211
-
212
- describe('`getStep`', () => {
213
- it('is a function', () => {
214
- expect(getStep)
215
- .to.be.a('function')
216
- })
217
- })
218
-
219
- describe('`isObject`', () => {
220
- it('is a function', () => {
221
- expect(isObject)
222
- .to.be.a('function')
223
- })
224
- })
225
-
226
- describe('`isArray`', () => {
227
- it('is a function', () => {
228
- expect(isArray)
229
- .to.be.a('function')
230
- })
231
- })
232
-
233
- describe('`toConstValue`', () => {
234
- it('is a function', () => {
235
- expect(toConstValue)
236
- .to.be.a('function')
237
- })
238
- })
239
-
240
- describe('`isConstValue`', () => {
241
- it('is a function', () => {
242
- expect(isConstValue)
243
- .to.be.a('function')
244
- })
245
- })
246
-
247
- describe('`toDefaultValue`', () => {
248
- it('is a function', () => {
249
- expect(toDefaultValue)
250
- .to.be.a('function')
251
- })
252
- })
253
-
254
- describe('`isDefaultValue`', () => {
255
- it('is a function', () => {
256
- expect(isDefaultValue)
257
- .to.be.a('function')
258
- })
259
- })
260
-
261
- describe('`getTitle`', () => {
262
- it('is a function', () => {
263
- expect(getTitle)
264
- .to.be.a('function')
265
- })
266
- })
267
-
268
- describe('`getDescription`', () => {
269
- it('is a function', () => {
270
- expect(getDescription)
271
- .to.be.a('function')
272
- })
273
- })
274
-
275
- describe('`getIsReadOnly`', () => {
276
- it('is a function', () => {
277
- expect(getIsReadOnly)
278
- .to.be.a('function')
279
- })
280
- })
281
-
282
- describe('`getIsWriteOnly`', () => {
283
- it('is a function', () => {
284
- expect(getIsWriteOnly)
285
- .to.be.a('function')
286
- })
287
- })
288
-
289
- describe('`hasEnum`', () => {
290
- it('is a function', () => {
291
- expect(hasEnum)
292
- .to.be.a('function')
293
- })
294
- })
295
-
296
- describe('`getEnum`', () => {
297
- it('is a function', () => {
298
- expect(getEnum)
299
- .to.be.a('function')
300
- })
301
- })
302
-
303
- describe('`hasConst`', () => {
304
- it('is a function', () => {
305
- expect(hasConst)
306
- .to.be.a('function')
307
- })
308
- })
309
-
310
- describe('`getConst`', () => {
311
- it('is a function', () => {
312
- expect(getConst)
313
- .to.be.a('function')
314
- })
315
- })
316
-
317
- describe('`hasOneOf`', () => {
318
- it('is a function', () => {
319
- expect(hasOneOf)
320
- .to.be.a('function')
321
- })
322
- })
323
-
324
- describe('`getOneOf`', () => {
325
- it('is a function', () => {
326
- expect(getOneOf)
327
- .to.be.a('function')
328
- })
329
- })
330
-
331
- describe('`hasAnyOf`', () => {
332
- it('is a function', () => {
333
- expect(hasAnyOf)
334
- .to.be.a('function')
335
- })
336
- })
337
-
338
- describe('`getAnyOf`', () => {
339
- it('is a function', () => {
340
- expect(getAnyOf)
341
- .to.be.a('function')
342
- })
343
- })
344
-
345
- describe('`getUri`', () => {
346
- it('is a function', () => {
347
- expect(getUri)
348
- .to.be.a('function')
349
- })
350
- })
351
-
352
- describe('`getPattern`', () => {
353
- it('is a function', () => {
354
- expect(getPattern)
355
- .to.be.a('function')
356
- })
357
- })
358
-
359
- describe('`getSelectedItems()`', () => {
360
- describe('Values has a field for the uri', () => {
361
- describe('The field is an array', () => {
362
- it('returns the array', () => {
363
- expect(getSelectedItems({ '#/': ['1'] }, '#/'))
364
- .to.eql([1])
365
- })
366
- })
367
-
368
- describe('The field is not an array', () => {
369
- it('returns an array', () => {
370
- expect(getSelectedItems({ '#/': '1' }, '#/'))
371
- .to.eql([1])
372
- })
373
- })
374
- })
375
-
376
- describe('Values does not have a field for the uri', () => {
377
- describe('Values has fields for the uri pattern', () => {
378
- it('returns an array', () => {
379
- expect(getSelectedItems({ '#/0': '1', '#/1': '2', '#/2': '3' }, '#/'))
380
- .to.eql([1, 2, 3])
381
- })
382
- })
383
-
384
- describe('Values does not have fields for the uri pattern', () => {
385
- it('returns an array', () => {
386
- expect(getSelectedItems({ '#/one': '1', '#/two': '2', '#/three': '3' }, '#/'))
387
- .to.eql([])
388
- })
389
- })
390
- })
391
- })
392
-
393
- describe('`getMetaProps()`', () => {
394
- describe('Params has a field for the uri', () => {
395
- it('returns an object', () => {
396
- expect(getMetaProps({ 'mock schema uri': { meta: { mockParamForUri: 'mock param for uri' } } }, 'mock schema uri'))
397
- .to.eql({ mockParamForUri: 'mock param for uri' })
398
- })
399
- })
400
-
401
- describe('Params does not have a field for the uri', () => {
402
- it('returns an object', () => {
403
- expect(getMetaProps({}, 'mock schema uri'))
404
- .to.eql({})
405
- })
406
- })
407
- })
408
-
409
- describe('`getMetaDefaultValue()`', () => {
410
- describe('Schema has a `default` field', () => {
411
- describe('`default` is a string', () => {
412
- it('returns a `defaultValue` object', () => {
413
- expect(getMetaDefaultValue({ default: 'MOCK DEFAULT' }))
414
- .to.eql({ defaultValue: 'MOCK DEFAULT' })
415
- })
416
- })
417
-
418
- describe('`default` is not a string', () => {
419
- it('returns a `defaultValue` object', () => {
420
- expect(getMetaDefaultValue({ default: false }))
421
- .to.eql({ defaultValue: 'false' })
422
- })
423
- })
424
- })
425
-
426
- describe('Schema does not have a `default` field', () => {
427
- it('returns an object', () => {
428
- expect(getMetaDefaultValue({}))
429
- .to.eql({})
430
- })
431
- })
432
- })
433
-
434
- describe('`getMetaValue()`', () => {
435
- describe('Values has a field for the uri', () => {
436
- describe('The value of the field is a string', () => {
437
- it('returns a `value` object', () => {
438
- expect(getMetaValue({ '#/': 'MOCK VALUE' }, '#/'))
439
- .to.eql({ value: 'MOCK VALUE' })
440
- })
441
- })
442
-
443
- describe('`value` is not a string', () => {
444
- it('returns a `value` object', () => {
445
- expect(getMetaValue({ '#/': false }, '#/'))
446
- .to.eql({ value: 'false' })
447
- })
448
- })
449
- })
450
-
451
- describe('Values does not have a field for the uri', () => {
452
- describe('Schema has a `const` field', () => {
453
- describe('`const` is a primitive', () => {
454
- it('returns a `value` object', () => {
455
- expect(getMetaValue({}, '#/', { const: 'MOCK CONST' }))
456
- .to.eql({ value: 'MOCK CONST' })
457
- })
458
- })
459
-
460
- describe('`const` is not a primitive', () => {
461
- it('returns an object', () => {
462
- expect(getMetaValue({}, '#/', { const: {} }))
463
- .to.eql({})
464
- })
465
- })
466
- })
467
-
468
- describe('Schema does not have a `const` field', () => {
469
- it('returns an object', () => {
470
- expect(getMetaValue({}))
471
- .to.eql({})
472
- })
473
- })
474
- })
475
- })
476
-
477
- describe('`getElementsTitleProps()`', () => {
478
- describe('Params has a `title` field for the uri', () => {
479
- it('returns a `title` object', () => {
480
- expect(getElementsTitleProps({ '#/': { elements: { title: { text: 'MOCK TITLE' } } } }, '#/'))
481
- .to.eql({ text: 'MOCK TITLE' })
482
- })
483
- })
484
-
485
- describe('Params does not have a `title` field for the uri', () => {
486
- it('returns an object', () => {
487
- expect(getElementsTitleProps({}, '#/'))
488
- .to.eql({})
489
- })
490
- })
491
- })
492
-
493
- describe('`getElementsDescriptionProps()`', () => {
494
- describe('Params has a `description` field for the uri', () => {
495
- it('returns a `description` object', () => {
496
- expect(getElementsDescriptionProps({ '#/': { elements: { description: { text: 'MOCK DESCRIPTION' } } } }, '#/'))
497
- .to.eql({ text: 'MOCK DESCRIPTION' })
498
- })
499
- })
500
-
501
- describe('Params does not have a `description` field for the uri', () => {
502
- it('returns an object', () => {
503
- expect(getElementsDescriptionProps({}, '#/'))
504
- .to.eql({})
505
- })
506
- })
507
- })
508
-
509
- describe('`getElementsFieldProps()`', () => {
510
- describe('Params has a `field` field for the uri', () => {
511
- it('returns a `field` object', () => {
512
- expect(getElementsFieldProps({ '#/': { elements: { field: { text: 'MOCK FIELD' } } } }, '#/'))
513
- .to.eql({ text: 'MOCK FIELD' })
514
- })
515
- })
516
-
517
- describe('Params does not have a `field` field for the uri', () => {
518
- it('returns an object', () => {
519
- expect(getElementsFieldProps({}, '#/'))
520
- .to.eql({})
521
- })
522
- })
523
- })
524
-
525
- describe('`getElementsFieldValue()`', () => {
526
- describe('Values has a field for the uri', () => {
527
- describe('The value of the field is a string', () => {
528
- it('returns a `value` object', () => {
529
- expect(getElementsFieldValue({ '#/': 'MOCK VALUE' }, '#/'))
530
- .to.eql({ value: 'MOCK VALUE' })
531
- })
532
- })
533
-
534
- describe('`value` is not a string', () => {
535
- it('returns a `value` object', () => {
536
- expect(getElementsFieldValue({ '#/': false }, '#/'))
537
- .to.eql({ value: 'false' })
538
- })
539
- })
540
- })
541
-
542
- describe('Values does not have a field for the uri', () => {
543
- describe('Schema has a `const` field', () => {
544
- describe('`const` is a primitive', () => {
545
- it('returns a `value` object', () => {
546
- expect(getElementsFieldValue({}, '#/', { const: 'MOCK CONST' }))
547
- .to.eql({ value: 'MOCK CONST' })
548
- })
549
- })
550
-
551
- describe('`const` is not a primitive', () => {
552
- it('returns a `value` object', () => {
553
- expect(getElementsFieldValue({}, '#/', { const: {} }))
554
- .to.eql({})
555
- })
556
- })
557
- })
558
-
559
- describe('Schema does not have a `const` field', () => {
560
- describe('Schema has a `default` field', () => {
561
- describe('`default` is a string', () => {
562
- it('returns a `value` object', () => {
563
- expect(getElementsFieldValue({}, '#/', { default: 'MOCK DEFAULT' }))
564
- .to.eql({ value: 'MOCK DEFAULT' })
565
- })
566
- })
567
-
568
- describe('`default` is not a string', () => {
569
- it('returns a `value` object', () => {
570
- expect(getElementsFieldValue({}, '#/', { default: false }))
571
- .to.eql({ value: 'false' })
572
- })
573
- })
574
- })
575
-
576
- describe('Schema does not have a `default` field', () => {
577
- it('returns an object', () => {
578
- expect(getElementsFieldValue({}))
579
- .to.eql({})
580
- })
581
- })
582
- })
583
- })
584
- })
585
-
586
- describe('`getMin()`', () => {
587
- describe('Schema has a `minimum` field', () => {
588
- describe('`minimum` is a number', () => {
589
- it('returns a `min` object', () => {
590
- expect(getMin({ minimum: 1 }))
591
- .to.eql({ min: 1 })
592
- })
593
- })
594
-
595
- describe('`minimum` is not a number', () => {
596
- it('returns an object', () => {
597
- expect(getMin({ minimum: 'MOCK MINIMUM' }))
598
- .to.eql({})
599
- })
600
- })
601
- })
602
-
603
- describe('Schema does not have a `minimum` field', () => {
604
- it('returns an object', () => {
605
- expect(getMin({}))
606
- .to.eql({})
607
- })
608
- })
609
- })
610
-
611
- describe('`getMax()`', () => {
612
- describe('Schema has a `maximum` field', () => {
613
- describe('`maximum` is a number', () => {
614
- it('returns a `max` object', () => {
615
- expect(getMax({ maximum: 1 }))
616
- .to.eql({ max: 1 })
617
- })
618
- })
619
-
620
- describe('`maximum` is not a number', () => {
621
- it('returns a `max` object', () => {
622
- expect(getMax({ maximum: 'MOCK MAXIMUM' }))
623
- .to.eql({})
624
- })
625
- })
626
- })
627
-
628
- describe('Schema does not have a `maximum` field', () => {
629
- it('returns an object', () => {
630
- expect(getMax({}))
631
- .to.eql({})
632
- })
633
- })
634
- })
635
-
636
- describe('`getMinLength()`', () => {
637
- describe('Schema has a `minLength` field', () => {
638
- describe('`minLength` is a number', () => {
639
- it('returns a `minLength` object', () => {
640
- expect(getMinLength({ minLength: 1 }))
641
- .to.eql({ minLength: 1 })
642
- })
643
- })
644
-
645
- describe('`minLength` is not a number', () => {
646
- it('returns an object', () => {
647
- expect(getMinLength({ minLength: 'MOCK MIN LENGTH' }))
648
- .to.eql({})
649
- })
650
- })
651
- })
652
-
653
- describe('Schema does not have a `minLength` field', () => {
654
- it('returns an object', () => {
655
- expect(getMinLength({}))
656
- .to.eql({})
657
- })
658
- })
659
- })
660
-
661
- describe('`getMaxLength()`', () => {
662
- describe('Schema has a `maxLength` field', () => {
663
- describe('`maxLength` is a number', () => {
664
- it('returns a `maxLength` object', () => {
665
- expect(getMaxLength({ maxLength: 1 }))
666
- .to.eql({ maxLength: 1 })
667
- })
668
- })
669
-
670
- describe('`maxLength` is not a number', () => {
671
- it('returns an object', () => {
672
- expect(getMaxLength({ maxLength: 'MOCK MAX LENGTH' }))
673
- .to.eql({})
674
- })
675
- })
676
- })
677
-
678
- describe('Schema does not have a `maxLength` field', () => {
679
- it('returns an object', () => {
680
- expect(getMaxLength({}))
681
- .to.eql({})
682
- })
683
- })
684
- })
685
-
686
- describe('`getMinItems()`', () => {
687
- describe('Schema has a `minItems` field', () => {
688
- describe('`minItems` is a number', () => {
689
- it('returns a `minItems` object', () => {
690
- expect(getMinItems({ minItems: 1 }))
691
- .to.eql({ minItems: 1 })
692
- })
693
- })
694
-
695
- describe('`minItems` is not a number', () => {
696
- it('returns an object', () => {
697
- expect(getMinItems({ minItems: 'MOCK MIN ITEMS' }))
698
- .to.eql({})
699
- })
700
- })
701
- })
702
-
703
- describe('Schema does not have a `minItems` field', () => {
704
- it('returns an object', () => {
705
- expect(getMinItems({}))
706
- .to.eql({})
707
- })
708
- })
709
- })
710
-
711
- describe('`getMaxItems()`', () => {
712
- describe('Schema has a `maxItems` field', () => {
713
- describe('`maxItems` is a number', () => {
714
- it('returns a `maxItems` object', () => {
715
- expect(getMaxItems({ maxItems: 1 }))
716
- .to.eql({ maxItems: 1 })
717
- })
718
- })
719
-
720
- describe('`maxItems` is not a number', () => {
721
- it('returns an object', () => {
722
- expect(getMaxItems({ maxItems: 'MOCK MAX ITEMS' }))
723
- .to.eql({})
724
- })
725
- })
726
- })
727
-
728
- describe('Schema does not have a `maxItems` field', () => {
729
- it('returns an object', () => {
730
- expect(getMaxItems({}))
731
- .to.eql({})
732
- })
733
- })
734
- })
735
-
736
- describe('`getHasUniqueItems()`', () => {
737
- describe('Schema has an `uniqueItems` field', () => {
738
- describe('`uniqueItems` is a boolean', () => {
739
- it('returns a `hasUniqueItems` object', () => {
740
- expect(getHasUniqueItems({ uniqueItems: true }))
741
- .to.eql({ hasUniqueItems: true })
742
- })
743
- })
744
-
745
- describe('`uniqueItems` is not a boolean', () => {
746
- it('returns an object', () => {
747
- expect(getHasUniqueItems({ uniqueItems: 'MOCK UNIQUE ITEMS' }))
748
- .to.eql({})
749
- })
750
- })
751
- })
752
-
753
- describe('Schema does not have an `uniqueItems` field', () => {
754
- it('returns an object', () => {
755
- expect(getHasUniqueItems({}))
756
- .to.eql({})
757
- })
758
- })
759
- })
760
-
761
- describe('`getMinContains()`', () => {
762
- describe('`minContains` is a number', () => {
763
- describe('Schema has a `minContains` field', () => {
764
- it('returns a `minContains` object', () => {
765
- expect(getMinContains({ minContains: 1 }))
766
- .to.eql({ minContains: 1 })
767
- })
768
- })
769
-
770
- describe('`minContains` is not a number', () => {
771
- it('returns an object', () => {
772
- expect(getMinContains({ minContains: 'MOCK MIN CONTAINS' }))
773
- .to.eql({})
774
- })
775
- })
776
- })
777
-
778
- describe('Schema does not have a `minContains` field', () => {
779
- it('returns an object', () => {
780
- expect(getMinContains({}))
781
- .to.eql({})
782
- })
783
- })
784
- })
785
-
786
- describe('`getMaxContains()`', () => {
787
- describe('Schema has a `maxContains` field', () => {
788
- describe('`maxContains` is a number', () => {
789
- it('returns a `maxContains` object', () => {
790
- expect(getMaxContains({ maxContains: 1 }))
791
- .to.eql({ maxContains: 1 })
792
- })
793
- })
794
-
795
- describe('`maxContains` is not a number', () => {
796
- it('returns an object', () => {
797
- expect(getMaxContains({ maxContains: 'MOCK MAX CONTAINS' }))
798
- .to.eql({})
799
- })
800
- })
801
- })
802
-
803
- describe('Schema does not have a `maxContains` field', () => {
804
- it('returns an object', () => {
805
- expect(getMaxContains({}))
806
- .to.eql({})
807
- })
808
- })
809
- })
810
-
811
- describe('`getMinProperties()`', () => {
812
- describe('`minProperties` is a number', () => {
813
- describe('Schema has a `minProperties` field', () => {
814
- it('returns a `minProperties` object', () => {
815
- expect(getMinProperties({ minProperties: 1 }))
816
- .to.eql({ minProperties: 1 })
817
- })
818
- })
819
-
820
- describe('`minProperties` is not a number', () => {
821
- it('returns an object', () => {
822
- expect(getMinContains({ minProperties: 'MOCK MIN PROPERTIES' }))
823
- .to.eql({})
824
- })
825
- })
826
- })
827
-
828
- describe('Schema does not have a `minProperties` field', () => {
829
- it('returns an object', () => {
830
- expect(getMinProperties({}))
831
- .to.eql({})
832
- })
833
- })
834
- })
835
-
836
- describe('`getMaxProperties()`', () => {
837
- describe('Schema has a `maxProperties` field', () => {
838
- describe('`maxProperties` is a number', () => {
839
- it('returns a `maxProperties` object', () => {
840
- expect(getMaxProperties({ maxProperties: 1 }))
841
- .to.eql({ maxProperties: 1 })
842
- })
843
- })
844
-
845
- describe('`maxProperties` is not a number', () => {
846
- it('returns an object', () => {
847
- expect(getMaxProperties({ maxProperties: 'MOCK MAX PROPERTIES' }))
848
- .to.eql({})
849
- })
850
- })
851
- })
852
-
853
- describe('Schema does not have a `maxProperties` field', () => {
854
- it('returns an object', () => {
855
- expect(getMaxProperties({}))
856
- .to.eql({})
857
- })
858
- })
859
- })
860
-
861
- describe('`getIsExclusiveMin()`', () => {
862
- describe('Schema has an `exclusiveMinimum` field', () => {
863
- describe('`exclusiveMinimum` is a boolean', () => {
864
- it('returns an `isExclusiveMin` object', () => {
865
- expect(getIsExclusiveMin({ exclusiveMinimum: true }))
866
- .to.eql({ isExclusiveMin: true })
867
- })
868
- })
869
-
870
- describe('`exclusiveMinimum` is not a boolean', () => {
871
- it('returns an object', () => {
872
- expect(getIsExclusiveMin({ exclusiveMinimum: 'MOCK EXCLUSIVE MINIMUM' }))
873
- .to.eql({})
874
- })
875
- })
876
- })
877
-
878
- describe('Schema does not have an `exclusiveMinimum` field', () => {
879
- it('returns an object', () => {
880
- expect(getIsExclusiveMin({}))
881
- .to.eql({})
882
- })
883
- })
884
- })
885
-
886
- describe('`getIsExclusiveMax()`', () => {
887
- describe('Schema has an `exclusiveMaximum` field', () => {
888
- describe('`exclusiveMaximum` is a boolean', () => {
889
- it('returns an `isExclusiveMax` object', () => {
890
- expect(getIsExclusiveMax({ exclusiveMaximum: true }))
891
- .to.eql({ isExclusiveMax: true })
892
- })
893
- })
894
-
895
- describe('`exclusiveMaximum` is not a boolean', () => {
896
- it('returns an `isExclusiveMax` object', () => {
897
- expect(getIsExclusiveMax({ exclusiveMaximum: 'MOCK IS EXCLUSIVE MAXIMUM' }))
898
- .to.eql({})
899
- })
900
- })
901
- })
902
-
903
- describe('Schema does not have an `exclusiveMaximum` field', () => {
904
- it('returns an object', () => {
905
- expect(getIsExclusiveMax({}))
906
- .to.eql({})
907
- })
908
- })
909
- })
910
-
911
- describe('`getStep()`', () => {
912
- describe('Schema has a `multipleOf` field', () => {
913
- describe('`multipleOf` is a number', () => {
914
- it('returns a `step` object', () => {
915
- expect(getStep({ multipleOf: 1 }))
916
- .to.eql({ step: 1 })
917
- })
918
- })
919
-
920
- describe('`multipleOf` is not a number', () => {
921
- it('returns a `step` object', () => {
922
- expect(getStep({ multipleOf: 'MOCK MULTIPLE OF' }))
923
- .to.eql({})
924
- })
925
- })
926
- })
927
-
928
- describe('Schema does not have a `multipleOf` field', () => {
929
- it('returns an object', () => {
930
- expect(getStep({}))
931
- .to.eql({})
932
- })
933
- })
934
- })
935
-
936
- describe('`isObject()`', () => {
937
- describe('The argument is a string', () => {
938
- it('returns false', () => (
939
- expect(isObject(''))
940
- .to.be.false
941
- ))
942
- })
943
-
944
- describe('The argument is a number', () => {
945
- it('returns false', () => (
946
- expect(isObject(0))
947
- .to.be.false
948
- ))
949
- })
950
-
951
- describe('The argument is an array', () => {
952
- it('returns false', () => (
953
- expect(isObject([]))
954
- .to.be.false
955
- ))
956
- })
957
-
958
- describe('The argument is an object', () => {
959
- it('returns true', () => (
960
- expect(isObject({}))
961
- .to.be.true
962
- ))
963
- })
964
-
965
- describe('The argument is a boolean', () => {
966
- it('returns false', () => (
967
- expect(isObject(false))
968
- .to.be.false
969
- ))
970
- })
971
-
972
- describe('The argument is null', () => {
973
- it('returns false', () => (
974
- expect(isObject(null))
975
- .to.be.false
976
- ))
977
- })
978
-
979
- describe('The argument is undefined', () => {
980
- it('returns false', () => (
981
- expect(isObject())
982
- .to.be.false
983
- ))
984
- })
985
- })
986
-
987
- describe('`isArray()`', () => {
988
- describe('The argument is a string', () => {
989
- it('returns false', () => (
990
- expect(isArray(''))
991
- .to.be.false
992
- ))
993
- })
994
-
995
- describe('The argument is a number', () => {
996
- it('returns false', () => (
997
- expect(isArray(0))
998
- .to.be.false
999
- ))
1000
- })
1001
-
1002
- describe('The argument is an array', () => {
1003
- it('returns true', () => (
1004
- expect(isArray([]))
1005
- .to.be.true
1006
- ))
1007
- })
1008
-
1009
- describe('The argument is an object', () => {
1010
- it('returns false', () => (
1011
- expect(isArray({}))
1012
- .to.be.false
1013
- ))
1014
- })
1015
-
1016
- describe('The argument is a boolean', () => {
1017
- it('returns false', () => (
1018
- expect(isArray(false))
1019
- .to.be.false
1020
- ))
1021
- })
1022
-
1023
- describe('The argument is null', () => {
1024
- it('returns false', () => (
1025
- expect(isArray(null))
1026
- .to.be.false
1027
- ))
1028
- })
1029
-
1030
- describe('The argument is undefined', () => {
1031
- it('returns false', () => (
1032
- expect(isArray())
1033
- .to.be.false
1034
- ))
1035
- })
1036
- })
1037
-
1038
- describe('`toConstValue()`', () => {
1039
- describe('Schema has an `const` field', () => {
1040
- it('returns the value of the field', () => (
1041
- expect(toConstValue({ const: 'MOCK CONST' }))
1042
- .to.eql('MOCK CONST')
1043
- ))
1044
- })
1045
-
1046
- describe('Schema does not have an `const` field', () => {
1047
- it('returns undefined', () => (
1048
- expect(toConstValue({}))
1049
- .to.be.undefined
1050
- ))
1051
- })
1052
- })
1053
-
1054
- describe('`isConstValue()`', () => {
1055
- describe('Schema has an `const` field', () => {
1056
- it('returns the value of the field', () => (
1057
- expect(isConstValue({ const: 'MOCK CONST' }))
1058
- .to.be.true
1059
- ))
1060
- })
1061
-
1062
- describe('Schema does not have an `const` field', () => {
1063
- it('returns undefined', () => (
1064
- expect(isConstValue({}))
1065
- .to.be.false
1066
- ))
1067
- })
1068
- })
1069
-
1070
- describe('`toDefaultValue()`', () => {
1071
- describe('Schema has an `default` field', () => {
1072
- it('returns the value of the field', () => (
1073
- expect(toDefaultValue({ default: 'MOCK DEFAULT' }))
1074
- .to.eql('MOCK DEFAULT')
1075
- ))
1076
- })
1077
-
1078
- describe('Schema does not have an `default` field', () => {
1079
- it('returns undefined', () => (
1080
- expect(toDefaultValue({}))
1081
- .to.be.undefined
1082
- ))
1083
- })
1084
- })
1085
-
1086
- describe('`isDefaultValue()`', () => {
1087
- describe('Schema has an `default` field', () => {
1088
- it('returns the value of the field', () => (
1089
- expect(isDefaultValue({ default: 'MOCK DEFAULT' }))
1090
- .to.be.true
1091
- ))
1092
- })
1093
-
1094
- describe('Schema does not have an `default` field', () => {
1095
- it('returns undefined', () => (
1096
- expect(isDefaultValue({}))
1097
- .to.be.false
1098
- ))
1099
- })
1100
- })
1101
-
1102
- describe('`getTitle()`', () => {
1103
- describe('Schema has a `title` field', () => {
1104
- describe('`title` is truthy', () => {
1105
- it('returns a `title` object', () => {
1106
- expect(getTitle({ title: 'MOCK TITLE' }))
1107
- .to.eql({ title: 'MOCK TITLE' })
1108
- })
1109
- })
1110
-
1111
- describe('`title` is falsy', () => {
1112
- it('returns an object', () => {
1113
- expect(getTitle({ title: '' }))
1114
- .to.eql({})
1115
- })
1116
- })
1117
- })
1118
-
1119
- describe('Schema does not have a `title` field', () => {
1120
- it('returns an object', () => {
1121
- expect(getTitle({}))
1122
- .to.eql({})
1123
- })
1124
- })
1125
- })
1126
-
1127
- describe('`getDescription()`', () => {
1128
- describe('Schema has a `description` field', () => {
1129
- describe('`description` is truthy', () => {
1130
- it('returns a `description` object', () => {
1131
- expect(getDescription({ description: 'MOCK DESCRIPTION' }))
1132
- .to.eql({ description: 'MOCK DESCRIPTION' })
1133
- })
1134
- })
1135
-
1136
- describe('`description` is falsy', () => {
1137
- it('returns an object', () => {
1138
- expect(getDescription({ description: '' }))
1139
- .to.eql({})
1140
- })
1141
- })
1142
- })
1143
-
1144
- describe('Schema does not have a `description` field', () => {
1145
- it('returns an object', () => {
1146
- expect(getDescription({}))
1147
- .to.eql({})
1148
- })
1149
- })
1150
- })
1151
-
1152
- describe('`hasEnum()`', () => {
1153
- describe('Schema has an `enum` field', () => {
1154
- it('returns true', () => (
1155
- expect(hasEnum({ enum: [] }))
1156
- .to.be.true
1157
- ))
1158
- })
1159
-
1160
- describe('Schema does not have an `enum` field', () => {
1161
- it('returns false', () => (
1162
- expect(hasEnum({}))
1163
- .to.be.false
1164
- ))
1165
- })
1166
- })
1167
-
1168
- describe('`getEnum()`', () => {
1169
- describe('Schema has an `enum` field', () => {
1170
- it('returns an array', () => (
1171
- expect(getEnum({ enum: [] }))
1172
- .to.eql([])
1173
- ))
1174
- })
1175
-
1176
- describe('Schema does not have an `enum` field', () => {
1177
- it('returns undefined', () => (
1178
- expect(getEnum({}))
1179
- .to.be.undefined
1180
- ))
1181
- })
1182
- })
1183
-
1184
- describe('`hasConst()`', () => {
1185
- it('is a function', () => {
1186
- expect(hasConst)
1187
- .to.be.a('function')
1188
- })
1189
- })
1190
-
1191
- describe('`getConst()`', () => {
1192
- it('is a function', () => {
1193
- expect(getConst)
1194
- .to.be.a('function')
1195
- })
1196
- })
1197
-
1198
- describe('`hasDefault()`', () => {
1199
- it('is a function', () => {
1200
- expect(hasDefault)
1201
- .to.be.a('function')
1202
- })
1203
- })
1204
-
1205
- describe('`getDefault()`', () => {
1206
- it('is a function', () => {
1207
- expect(getDefault)
1208
- .to.be.a('function')
1209
- })
1210
- })
1211
-
1212
- describe('`hasAnyOf()`', () => {
1213
- describe('Schema has an `anyOf` field', () => {
1214
- it('returns true', () => (
1215
- expect(hasAnyOf({ anyOf: [] }))
1216
- .to.be.true
1217
- ))
1218
- })
1219
-
1220
- describe('Schema does not have an `anyOf` field', () => {
1221
- it('returns false', () => (
1222
- expect(hasAnyOf({}))
1223
- .to.be.false
1224
- ))
1225
- })
1226
- })
1227
-
1228
- describe('`getAnyOf()`', () => {
1229
- describe('Schema has an `anyOf` field', () => {
1230
- it('returns an array', () => {
1231
- expect(getAnyOf({ anyOf: [] }))
1232
- .to.eql([])
1233
- })
1234
- })
1235
-
1236
- describe('Schema does not have an `anyOf` field', () => {
1237
- it('returns undefined', () => (
1238
- expect(getAnyOf({}))
1239
- .to.be.undefined
1240
- ))
1241
- })
1242
- })
1243
-
1244
- describe('`hasOneOf()`', () => {
1245
- describe('Schema has an `oneOf` field', () => {
1246
- it('returns true', () => (
1247
- expect(hasOneOf({ oneOf: [] }))
1248
- .to.be.true
1249
- ))
1250
- })
1251
-
1252
- describe('Schema does not have an `oneOf` field', () => {
1253
- it('returns false', () => (
1254
- expect(hasOneOf({}))
1255
- .to.be.false
1256
- ))
1257
- })
1258
- })
1259
-
1260
- describe('`getOneOf()`', () => {
1261
- describe('Schema has an `oneOf` field', () => {
1262
- it('returns an array', () => {
1263
- expect(getOneOf({ oneOf: [] }))
1264
- .to.eql([])
1265
- })
1266
- })
1267
-
1268
- describe('Schema does not have an `oneOf` field', () => {
1269
- it('returns undefined', () => (
1270
- expect(getOneOf({}))
1271
- .to.be.undefined
1272
- ))
1273
- })
1274
- })
1275
-
1276
- describe('`hasAllOf()`', () => {
1277
- describe('Schema has an `allOf` field', () => {
1278
- it('returns true', () => (
1279
- expect(hasAllOf({ allOf: [] }))
1280
- .to.be.true
1281
- ))
1282
- })
1283
-
1284
- describe('Schema does not have an `allOf` field', () => {
1285
- it('returns false', () => (
1286
- expect(hasAllOf({}))
1287
- .to.be.false
1288
- ))
1289
- })
1290
- })
1291
-
1292
- describe('`getAllOf()`', () => {
1293
- describe('Schema has an `allOf` field', () => {
1294
- it('returns an array', () => {
1295
- expect(getAllOf({ allOf: [] }))
1296
- .to.eql([])
1297
- })
1298
- })
1299
-
1300
- describe('Schema does not have an `allOf` field', () => {
1301
- it('returns undefined', () => (
1302
- expect(getAllOf({}))
1303
- .to.be.undefined
1304
- ))
1305
- })
1306
- })
1307
-
1308
- describe('`getUri()`', () => {
1309
- describe('A `uri` is defined', () => {
1310
- describe('A `resource` is defined', () => {
1311
- it('returns a string', () => {
1312
- expect(getUri('mock uri', 'mock resource'))
1313
- .to.equal('mock uri/mock resource')
1314
- })
1315
- })
1316
-
1317
- describe('A `resource` is not defined', () => {
1318
- it('returns a string', () => {
1319
- expect(getUri('mock uri'))
1320
- .to.equal('mock uri/')
1321
- })
1322
- })
1323
- })
1324
-
1325
- describe('A `uri` is not defined', () => {
1326
- it('returns a string', () => {
1327
- expect(getUri())
1328
- .to.equal('#/')
1329
- })
1330
- })
1331
- })
1332
-
1333
- describe('`getPattern()`', () => {
1334
- describe('Schema has a `pattern` field', () => {
1335
- it('returns a `pattern` object', () => {
1336
- expect(getPattern({ pattern: 'MOCK PATTERN' }))
1337
- .to.eql({ pattern: 'MOCK PATTERN' })
1338
- })
1339
- })
1340
-
1341
- describe('Schema does not have a `pattern` field', () => {
1342
- it('returns an object', () => {
1343
- expect(getPattern({}))
1344
- .to.eql({})
1345
- })
1346
- })
1347
- })
1348
- })