Skip to content

Commit bd17e92

Browse files
committed
Add tests for $defs and const normalizers
1 parent b365739 commit bd17e92

File tree

4 files changed

+66
-18
lines changed

4 files changed

+66
-18
lines changed

test/__snapshots__/test/test.ts.md

+40-18
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,24 @@ Generated by [AVA](https://avajs.dev).
182182
}␊
183183
`
184184

185+
## Non object items.items
186+
187+
> Snapshot 1
188+
189+
`{␊
190+
"id": "foo",␊
191+
"type": "object",␊
192+
"properties": {␊
193+
"myProperty": {␊
194+
"type": "array",␊
195+
"items": "string",␊
196+
"minItems": 0␊
197+
}␊
198+
},␊
199+
"additionalProperties": false,␊
200+
"required": []␊
201+
}`
202+
185203
## Normalise ignoreMinAndMaxItems
186204

187205
> Snapshot 1
@@ -524,6 +542,28 @@ Generated by [AVA](https://avajs.dev).
524542
"required": []␊
525543
}`
526544

545+
## Normalize $defs to definitions
546+
547+
> Snapshot 1
548+
549+
`{␊
550+
"id": "foo",␊
551+
"definitions": {␊
552+
"bar": "baz"␊
553+
}␊
554+
}`
555+
556+
## Normalize const to singleton enum
557+
558+
> Snapshot 1
559+
560+
`{␊
561+
"id": "foo",␊
562+
"enum": [␊
563+
"foobar"␊
564+
]␊
565+
}`
566+
527567
## Normalize schema.items
528568

529569
> Snapshot 1
@@ -3555,21 +3595,3 @@ Generated by [AVA](https://avajs.dev).
35553595
[k: string]: unknown;␊
35563596
}␊
35573597
`
3558-
3559-
## Non object items.items
3560-
3561-
> Snapshot 1
3562-
3563-
`{␊
3564-
"id": "foo",␊
3565-
"type": "object",␊
3566-
"properties": {␊
3567-
"myProperty": {␊
3568-
"type": "array",␊
3569-
"items": "string",␊
3570-
"minItems": 0␊
3571-
}␊
3572-
},␊
3573-
"additionalProperties": false,␊
3574-
"required": []␊
3575-
}`

test/__snapshots__/test/test.ts.snap

16 Bytes
Binary file not shown.

test/normalizer/constToEnum.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "Normalize const to singleton enum",
3+
"in": {
4+
"id": "foo",
5+
"const": "foobar"
6+
},
7+
"out": {
8+
"id": "foo",
9+
"enum": ["foobar"]
10+
}
11+
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "Normalize $defs to definitions",
3+
"in": {
4+
"id": "foo",
5+
"$defs" : {
6+
"bar": "baz"
7+
}
8+
},
9+
"out": {
10+
"id": "foo",
11+
"definitions" : {
12+
"bar": "baz"
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)