11import { 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" ;
1112
1213
1314describe ( "getDialectIds function" , ( ) => {
@@ -34,14 +35,13 @@ describe("getDialectIds function", () => {
3435 } ) ;
3536
3637 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+ }
4545 } ) ;
4646 const dialectIds = getDialectIds ( ) ;
4747 expect ( dialectIds ) . toEqual ( [
@@ -61,8 +61,7 @@ describe("getDialectIds function", () => {
6161 "https://spec.openapis.org/oas/3.1/schema-draft-06" ,
6262 "https://spec.openapis.org/oas/3.1/schema-draft-04" ,
6363 "https://json-schema.org/validation" ,
64- "http://example.com/dialect1" ,
65- "http://example.com/dialect2"
64+ "http://example.com/dialect1"
6665 ] ) ;
6766 } ) ;
6867} ) ;
0 commit comments