@@ -76,22 +76,28 @@ describe("utils", () => {
76
76
expect ( parseRef ( "#/test/~1~0" ) ) . toStrictEqual ( { filename : "." , path : [ "test" , "/~" ] } ) ;
77
77
} ) ;
78
78
79
+ it ( "remote ref" , ( ) => {
80
+ expect ( parseRef ( "remote.yaml#/Subpath" ) ) . toStrictEqual ( { filename : "remote.yaml" , path : [ "Subpath" ] } ) ;
81
+ expect ( parseRef ( "../schemas/remote.yaml#/Subpath" ) ) . toStrictEqual ( { filename : "../schemas/remote.yaml" , path : [ "Subpath" ] } ) ;
82
+ expect ( parseRef ( "https://myschema.com/api/v1/openapi.yaml#/Subpath" ) ) . toStrictEqual ( { filename : "https://myschema.com/api/v1/openapi.yaml" , path : [ "Subpath" ] } ) ;
83
+ } ) ;
84
+
79
85
it ( "js-yaml $ref" , ( ) => {
80
86
expect ( parseRef ( 'components["schemas"]["SchemaObject"]' ) ) . toStrictEqual ( { filename : "." , path : [ "components" , "schemas" , "SchemaObject" ] } ) ;
81
87
} ) ;
82
88
} ) ;
83
89
84
90
describe ( "escObjKey" , ( ) => {
85
91
it ( "basic" , ( ) => {
86
- expect ( escObjKey ( "some-prop" ) ) . toStrictEqual ( "\" some-prop\"" ) ;
92
+ expect ( escObjKey ( "some-prop" ) ) . toStrictEqual ( '" some-prop"' ) ;
87
93
} ) ;
88
94
89
95
it ( "@ escapes" , ( ) => {
90
- expect ( escObjKey ( "@type" ) ) . toStrictEqual ( "\" @type\"" ) ;
96
+ expect ( escObjKey ( "@type" ) ) . toStrictEqual ( '" @type"' ) ;
91
97
} ) ;
92
98
93
99
it ( "number escapes" , ( ) => {
94
- expect ( escObjKey ( "123var" ) ) . toStrictEqual ( "\" 123var\"" ) ;
100
+ expect ( escObjKey ( "123var" ) ) . toStrictEqual ( '" 123var"' ) ;
95
101
} ) ;
96
102
97
103
it ( "only number no escapes" , ( ) => {
@@ -104,6 +110,6 @@ describe("utils", () => {
104
110
105
111
it ( "_ no escapes" , ( ) => {
106
112
expect ( escObjKey ( "_ref_" ) ) . toStrictEqual ( "_ref_" ) ;
107
- } )
108
- } )
113
+ } ) ;
114
+ } ) ;
109
115
} ) ;
0 commit comments