@@ -60,7 +60,7 @@ describe('StaticPageComponent', () => {
6060
6161 it ( 'should rewrite OAI link with rest.baseUrl' , async ( ) => {
6262 const oaiHtml = '<a href="/server/oai/request?verb=ListSets">OAI</a>' ;
63- const { fixture, component } = await setupTest ( oaiHtml , 'https://api.example.org/rest ' ) ;
63+ const { fixture, component } = await setupTest ( oaiHtml , 'https://api.example.org/server ' ) ;
6464
6565 await component . ngOnInit ( ) ;
6666 fixture . detectChanges ( ) ;
@@ -83,18 +83,31 @@ describe('StaticPageComponent', () => {
8383
8484 it ( 'should avoid double slashes when rest.baseUrl ends with slash' , async ( ) => {
8585 const oaiHtml = '<a href="/server/oai/request?verb=ListRecords">OAI</a>' ;
86- const { fixture, component } = await setupTest ( oaiHtml , 'https://api.example.org/rest /' ) ;
86+ const { fixture, component } = await setupTest ( oaiHtml , 'https://api.example.org/server /' ) ;
8787
8888 await component . ngOnInit ( ) ;
8989 fixture . detectChanges ( ) ;
9090
9191 expect ( component . htmlContent . value ) . toContain ( 'https://api.example.org/server/oai/request?verb=ListRecords' ) ;
92- expect ( component . htmlContent . value ) . not . toContain ( '//server' ) ;
92+ expect ( component . htmlContent . value ) . not . toContain ( '//oai' ) ;
93+ } ) ;
94+
95+ it ( 'should include namespace in OAI link when rest.baseUrl has namespace prefix' , async ( ) => {
96+ const oaiHtml = '<a href="/server/oai/request?verb=ListMetadataFormats">full list</a>' ;
97+ const { fixture, component } = await setupTest ( oaiHtml , 'https://api.example.org/repository/server' ) ;
98+
99+ await component . ngOnInit ( ) ;
100+ fixture . detectChanges ( ) ;
101+
102+ const rewritten = 'https://api.example.org/repository/server/oai/request?verb=ListMetadataFormats' ;
103+ expect ( component . htmlContent . value ) . toContain ( rewritten ) ;
104+ const anchor = fixture . nativeElement . querySelector ( 'a' ) ;
105+ expect ( anchor . getAttribute ( 'href' ) ) . toBe ( rewritten ) ;
93106 } ) ;
94107
95108 it ( 'should leave content unchanged when no OAI link is present' , async ( ) => {
96109 const otherHtml = '<a href="/server/other">Other</a>' ;
97- const { fixture, component } = await setupTest ( otherHtml , 'https://api.example.org/rest ' ) ;
110+ const { fixture, component } = await setupTest ( otherHtml , 'https://api.example.org/server ' ) ;
98111
99112 await component . ngOnInit ( ) ;
100113 fixture . detectChanges ( ) ;
0 commit comments