1
1
import { test , expect , describe } from "vitest" ;
2
- import { getDialectIds , loadDialect } from "./keywords.js" ;
3
- import "../draft-2020-12" ;
4
- import "../draft-2019-09" ;
5
- import "../draft-04" ;
6
- import "../draft-06" ;
7
- import "../draft-07" ;
8
- import "../openapi-3-0" ;
9
- import "../openapi-3-1" ;
10
- import "../stable" ;
2
+ import { getDialectIds } from "./experimental.js" ;
3
+ import { registerSchema } from "./schema.js" ;
4
+ import "../draft-2020-12/index.js" ;
5
+ import "../draft-2019-09/index.js" ;
6
+ import "../draft-04/index.js" ;
7
+ import "../draft-06/index.js" ;
8
+ import "../draft-07/index.js" ;
9
+ import "../openapi-3-0/index.js" ;
10
+ import "../openapi-3-1/index.js" ;
11
+ import "../stable/index.js" ;
11
12
12
13
13
14
describe ( "getDialectIds function" , ( ) => {
@@ -34,14 +35,13 @@ describe("getDialectIds function", () => {
34
35
} ) ;
35
36
36
37
test ( "returns an array of dialect identifiers that are either imported in the file or loaded as custom dialects" , ( ) => {
37
- //Load some dialects before each test
38
- loadDialect ( "http://example.com/dialect1" , {
39
- "https://json-schema.org/draft/2020-12/vocab/core" : true ,
40
- "https://json-schema.org/draft/2020-12/vocab/applicator" : true
41
- } ) ;
42
- loadDialect ( "http://example.com/dialect2" , {
43
- "https://json-schema.org/draft/2020-12/vocab/core" : true ,
44
- "https://json-schema.org/draft/2020-12/vocab/applicator" : true
38
+ registerSchema ( {
39
+ "$id" : "http://example.com/dialect1" ,
40
+ "$schema" : "https://json-schema.org/draft/2020-12/schema" ,
41
+ "$vocabulary" : {
42
+ "https://json-schema.org/draft/2020-12/vocab/core" : true ,
43
+ "https://json-schema.org/draft/2020-12/vocab/applicator" : true
44
+ }
45
45
} ) ;
46
46
const dialectIds = getDialectIds ( ) ;
47
47
expect ( dialectIds ) . toEqual ( [
@@ -61,8 +61,7 @@ describe("getDialectIds function", () => {
61
61
"https://spec.openapis.org/oas/3.1/schema-draft-06" ,
62
62
"https://spec.openapis.org/oas/3.1/schema-draft-04" ,
63
63
"https://json-schema.org/validation" ,
64
- "http://example.com/dialect1" ,
65
- "http://example.com/dialect2"
64
+ "http://example.com/dialect1"
66
65
] ) ;
67
66
} ) ;
68
67
} ) ;
0 commit comments