@@ -101,6 +101,24 @@ test("getDocumentLoader()", async (t) => {
101101 } ,
102102 ) ) ;
103103
104+ mf . mock ( "GET@/obj-w-wrong-link" , ( _req ) =>
105+ new Response (
106+ JSON . stringify ( {
107+ "@context" : "https://www.w3.org/ns/activitystreams" ,
108+ id : "https://example.com/obj-w-wrong-link" ,
109+ name : "Fetched object" ,
110+ type : "Object" ,
111+ } ) ,
112+ {
113+ status : 200 ,
114+ headers : {
115+ "Content-Type" : "text/html; charset=utf-8" ,
116+ Link : '<https://example.com/object>; rel="alternate"; ' +
117+ 'type="application/ld+json; profile="https://www.w3.org/ns/activitystreams""' ,
118+ } ,
119+ } ,
120+ ) ) ;
121+
104122 await t . step ( "Link header" , async ( ) => {
105123 assertEquals ( await fetchDocumentLoader ( "https://example.com/link-ctx" ) , {
106124 contextUrl : "https://www.w3.org/ns/activitystreams" ,
@@ -150,6 +168,22 @@ test("getDocumentLoader()", async (t) => {
150168 ) ;
151169 } ) ;
152170
171+ await t . step ( "wrong Link header syntax" , async ( ) => {
172+ assertEquals (
173+ await fetchDocumentLoader ( "https://example.com/obj-w-wrong-link" ) ,
174+ {
175+ contextUrl : null ,
176+ documentUrl : "https://example.com/obj-w-wrong-link" ,
177+ document : {
178+ "@context" : "https://www.w3.org/ns/activitystreams" ,
179+ id : "https://example.com/obj-w-wrong-link" ,
180+ name : "Fetched object" ,
181+ type : "Object" ,
182+ } ,
183+ } ,
184+ ) ;
185+ } ) ;
186+
153187 mf . mock ( "GET@/html-link" , ( _req ) =>
154188 new Response (
155189 `<html>
0 commit comments