Skip to content

Commit 838172d

Browse files
committed
test: CustomizeType
1 parent 9f1fc5d commit 838172d

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed

__tests__/JSONSchemaViewer/__snapshots__/generic_keywords.test.tsx.snap

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,113 @@ exports[`JSONSchemaViewer - Generic keywords test annotations 1`] = `
128128
</details>
129129
`;
130130

131+
exports[`JSONSchemaViewer - Generic keywords test const (as single enum value) 1`] = `
132+
<details
133+
open={true}
134+
>
135+
<summary>
136+
<strong>
137+
Schema
138+
</strong>
139+
</summary>
140+
<div>
141+
<div>
142+
<strong>
143+
type
144+
</strong>
145+
 : 
146+
<span
147+
style={
148+
{
149+
"opacity": "0.6",
150+
}
151+
}
152+
>
153+
object
154+
</span>
155+
<ul>
156+
<li
157+
data-level={1}
158+
id="/properties/country"
159+
>
160+
<details
161+
open={false}
162+
>
163+
<summary>
164+
<strong>
165+
country
166+
</strong>
167+
 
168+
<code>
169+
"US"
170+
</code>
171+
 
172+
<strong>
173+
constant
174+
</strong>
175+
</summary>
176+
<div>
177+
<div>
178+
<strong>
179+
type
180+
</strong>
181+
 : 
182+
<span
183+
style={
184+
{
185+
"opacity": "0.6",
186+
}
187+
}
188+
>
189+
string
190+
</span>
191+
<div
192+
style={
193+
{
194+
"marginTop": "var(--ifm-table-cell-padding)",
195+
}
196+
}
197+
>
198+
<div>
199+
<strong>
200+
Possible values :
201+
</strong>
202+
 
203+
<ul>
204+
<li>
205+
<code>
206+
US
207+
</code>
208+
</li>
209+
</ul>
210+
</div>
211+
</div>
212+
<div
213+
style={
214+
{
215+
"marginTop": "var(--ifm-table-cell-padding)",
216+
}
217+
}
218+
>
219+
const (as single enum value)
220+
</div>
221+
</div>
222+
</div>
223+
</details>
224+
</li>
225+
</ul>
226+
<div
227+
style={
228+
{
229+
"marginTop": "var(--ifm-table-cell-padding)",
230+
}
231+
}
232+
/>
233+
</div>
234+
</div>
235+
</details>
236+
`;
237+
131238
exports[`JSONSchemaViewer - Generic keywords test const 1`] = `
132239
<details
133240
open={true}

__tests__/JSONSchemaViewer/generic_keywords.test.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ const testcases: [string, JSONSchema][] = [
4343
examples: ["red"],
4444
},
4545
],
46+
[
47+
"const (as single enum value)",
48+
{
49+
properties: {
50+
country: {
51+
enum: ["US"],
52+
description: "const (as single enum value)",
53+
},
54+
},
55+
},
56+
],
4657
]
4758

4859
describe("JSONSchemaViewer - Generic keywords", () => {

0 commit comments

Comments
 (0)