1
1
import { test , expect , describe } from "vitest" ;
2
- import { getDialectIds , loadDialect } from "./keywords.js" ;
2
+ import { getDialectIds } from "./experimental.js" ;
3
+ import { registerSchema } from "./schema.js" ;
3
4
import "../draft-2020-12" ;
4
5
import "../draft-2019-09" ;
5
6
import "../draft-04" ;
@@ -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