File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ function build (schema, options) {
110
110
if ( validLargeArrayMechanisms . includes ( options . largeArrayMechanism ) ) {
111
111
largeArrayMechanism = options . largeArrayMechanism
112
112
} else {
113
- throw new Error ( `Unsupported large array mechanism ${ options . rounding } ` )
113
+ throw new Error ( `Unsupported large array mechanism ${ options . largeArrayMechanism } ` )
114
114
}
115
115
}
116
116
Original file line number Diff line number Diff line change @@ -4,6 +4,24 @@ const test = require('tap').test
4
4
const validator = require ( 'is-my-json-valid' )
5
5
const build = require ( '..' )
6
6
7
+ test ( 'error on invalid largeArrayMechanism' , ( t ) => {
8
+ t . plan ( 1 )
9
+
10
+ t . throws ( ( ) => build ( {
11
+ title : 'large array of null values with default mechanism' ,
12
+ type : 'object' ,
13
+ properties : {
14
+ ids : {
15
+ type : 'array' ,
16
+ items : { type : 'null' }
17
+ }
18
+ }
19
+ } , {
20
+ largeArraySize : 2e4 ,
21
+ largeArrayMechanism : 'invalid'
22
+ } ) , Error ( 'Unsupported large array mechanism invalid' ) )
23
+ } )
24
+
7
25
function buildTest ( schema , toStringify , options ) {
8
26
test ( `render a ${ schema . title } as JSON` , ( t ) => {
9
27
t . plan ( 3 )
You can’t perform that action at this time.
0 commit comments