@@ -267,17 +267,28 @@ describe('parser', () => {
267267 ] ) ;
268268 } ) ;
269269
270- it ( 'should parse text/shaclc with baseIRI' , ( ) => {
270+ it ( 'should parse text/shaclc with baseIRI' , async ( ) => {
271271 const stream = stringToStream ( `
272272 BASE <http://localhost:3002/ContactsShape>
273273 PREFIX cont: <http://localhost:3002/ContactsShape#>
274274
275275 shape cont:ContactsShape {}
276276 ` ) ;
277- return expect ( arrayifyStream ( rdfParser . parse ( stream , { contentType : 'text/shaclc' } ) ) )
277+
278+ const prefixes : Record < string , string > = { } ;
279+ const result = arrayifyStream ( rdfParser . parse ( stream , { contentType : 'text/shaclc' } )
280+ . on ( 'prefix' , ( prefix : string , iri : string ) => prefixes [ prefix ] = iri ) ) ;
281+
282+ await expect ( result )
278283 . resolves . toBeRdfIsomorphic ( [
279284 quad ( "http://localhost:3002/ContactsShape#ContactsShape" , "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" , "http://www.w3.org/ns/shacl#NodeShape" ) ,
280285 quad ( "http://localhost:3002/ContactsShape" , "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" , "http://www.w3.org/2002/07/owl#Ontology" ) ,
281286 ] ) ;
287+
288+ expect ( prefixes ) . toMatchObject ( {
289+ cont : 'http://localhost:3002/ContactsShape#' ,
290+ rdf : 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' ,
291+ sh : 'http://www.w3.org/ns/shacl#' ,
292+ } ) ;
282293 } ) ;
283294} ) ;
0 commit comments