@@ -7,6 +7,7 @@ import { WebidParsingError } from "../../../src/error/WebidParsingError";
77jest . mock ( "node-fetch" , ( ) => jest . fn ( ) ) ;
88
99const webid = "https://example.com/webid#" ;
10+ const webidDocument = "https://example.com/webid" ;
1011
1112describe ( "retrieveWebidTrustedOidcIssuers" , ( ) => {
1213 it ( "returns the trusted OIDC issuer of a WebID" , async ( ) => {
@@ -16,6 +17,7 @@ describe("retrieveWebidTrustedOidcIssuers", () => {
1617 text : ( ) => {
1718 return `<${ webid } > <http://www.w3.org/ns/solid/terms#oidcIssuer> <https://example.issuer.com/> .` ;
1819 } ,
20+ url : webidDocument ,
1921 } ) ,
2022 ) ;
2123
@@ -31,6 +33,7 @@ describe("retrieveWebidTrustedOidcIssuers", () => {
3133 text : ( ) => {
3234 return `<${ webid } > <http://www.w3.org/ns/solid/terms#oidcIssuer> <https://example.issuer.com/>, <https://example.other.issuer.com/> .` ;
3335 } ,
36+ url : webidDocument ,
3437 } ) ,
3538 ) ;
3639
@@ -40,13 +43,32 @@ describe("retrieveWebidTrustedOidcIssuers", () => {
4043 ] ) ;
4144 } ) ;
4245
46+ it ( "returns the trusted OIDC issuers with relative paths and redirect webId" , async ( ) => {
47+ const webidDocumentRedirect = "https://webid.example/profile/card" ;
48+
49+ ( fetch as unknown as jest . Mock ) . mockImplementationOnce ( ( ) =>
50+ Promise . resolve ( {
51+ ok : true ,
52+ text : ( ) => {
53+ return `<${ webid } > <http://www.w3.org/ns/solid/terms#oidcIssuer> <../> .` ;
54+ } ,
55+ url : webidDocumentRedirect ,
56+ } ) ,
57+ ) ;
58+
59+ expect ( await retrieveWebidTrustedOidcIssuers ( webid ) ) . toStrictEqual ( [
60+ "https://webid.example/" ,
61+ ] ) ;
62+ } ) ;
63+
4364 it ( "ignores issuers in a non-default graph" , async ( ) => {
4465 ( fetch as unknown as jest . Mock ) . mockImplementationOnce ( ( ) =>
4566 Promise . resolve ( {
4667 ok : true ,
4768 text : ( ) => {
4869 return `<#g> { <${ webid } > <http://www.w3.org/ns/solid/terms#oidcIssuer> <https://example.issuer.com/> . }` ;
4970 } ,
71+ url : webidDocument ,
5072 } ) ,
5173 ) ;
5274
@@ -83,6 +105,7 @@ describe("retrieveWebidTrustedOidcIssuers", () => {
83105 text : ( ) => {
84106 return "very invalid turtle" ;
85107 } ,
108+ url : webidDocument ,
86109 } ) ,
87110 ) ;
88111
0 commit comments