ng-inline-svg icon indicating copy to clipboard operation
ng-inline-svg copied to clipboard

relative baseUrl path for unit tests

Open michahell opened this issue 5 years ago • 3 comments

Hi,

this is not a blocker but I would like to point to a different (relative) URL for Angular unit tests, so we don't see 404's in the spec output:

04 05 2020 13:33:42.878:WARN [web-server]: 404: /assets/icons/search.svg

I tried the following baseUrl:

InlineSVGModule.forRoot({
  baseUrl: '../../libs'
})

but the ../../ part seems to be removed:

04 05 2020 13:33:42.878:WARN [web-server]: 404: /libs/assets/icons/search.svg

This does not seem to explicitly happen in getAbsoluteUrl(): https://github.com/arkon/ng-inline-svg/blob/5b675dce50b62e3dbd9d73cf38826c7fb81de7e0/src/svg-cache.service.ts#L83

When I put a console log there to see what url and _baseUrl are, I do see: '/assets/icons/search.svg' and '../../libs' consecutively. So I know that the config override is applied, at least.

michahell avatar May 04 '20 11:05 michahell

I imagine it's getting lost here: https://github.com/arkon/ng-inline-svg/blob/5b675dce50b62e3dbd9d73cf38826c7fb81de7e0/src/svg-cache.service.ts#L95-L98

Does that relative path actually resolve to a valid URL? (i.e. what's the absolute form of it?)

arkon avatar May 30 '20 15:05 arkon

Yes, this was my finding as well! Not sure why I forgot to add this to the original issue.

michahell avatar Jun 10 '20 12:06 michahell

I am picking this up again. I'm trying to debug my unit tests while including a breakpoint in said service on mentioned line, but having a bit of trouble getting the breakpoint to work.

michahell avatar Nov 19 '20 12:11 michahell