@@ -29,15 +29,31 @@ describe('resolve', function () {
29
29
} ) ;
30
30
31
31
context ( 'resolveApiDOM' , function ( ) {
32
- specify ( 'should resolve an ApiDOM fragment' , async function ( ) {
33
- const fragment = await parse ( rootFilePath , {
34
- parse : { mediaType : 'application/vnd.oai.openapi+json;version=3.1.0' } ,
35
- } ) ;
36
- const refSet = await resolveApiDOM ( fragment , {
37
- resolve : { baseURI : rootFilePath } ,
32
+ context ( 'given fragment is instance of ParseResultElement' , function ( ) {
33
+ specify ( 'should resolve an ApiDOM fragment' , async function ( ) {
34
+ const fragment = await parse ( rootFilePath , {
35
+ parse : { mediaType : 'application/vnd.oai.openapi+json;version=3.1.0' } ,
36
+ } ) ;
37
+ const refSet = await resolveApiDOM ( fragment , {
38
+ resolve : { baseURI : rootFilePath } ,
39
+ } ) ;
40
+
41
+ assert . strictEqual ( refSet . size , 2 ) ;
38
42
} ) ;
43
+ } ) ;
39
44
40
- assert . strictEqual ( refSet . size , 2 ) ;
45
+ context ( "given fragment isn't instance of ParseResultElement" , function ( ) {
46
+ specify ( 'should resolve an ApiDOM fragment' , async function ( ) {
47
+ const { api } = await parse ( rootFilePath , {
48
+ parse : { mediaType : 'application/vnd.oai.openapi+json;version=3.1.0' } ,
49
+ } ) ;
50
+ // @ts -ignore
51
+ const refSet = await resolveApiDOM ( api , {
52
+ resolve : { baseURI : rootFilePath } ,
53
+ } ) ;
54
+
55
+ assert . strictEqual ( refSet . size , 2 ) ;
56
+ } ) ;
41
57
} ) ;
42
58
} ) ;
43
59
} ) ;
0 commit comments