Allow Addons that affect img tags to be tested

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2022-05-09 16:54:10 +02:00
parent ac5b0e5c5e
commit f84e0e2818
2 changed files with 9 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs-addons-test-utils': patch
---
Fixed a bug preventing testing of TechDocs Addons whose dom contained `<img />` tags.
@@ -46,6 +46,7 @@ const techdocsApi = {
const techdocsStorageApi = {
getApiOrigin: jest.fn(),
getBaseUrl: jest.fn(),
getEntityDocs: jest.fn(),
syncEntityDocs: jest.fn(),
};
@@ -180,7 +181,9 @@ export class TechDocsAddonTester {
techdocsStorageApi.getApiOrigin.mockResolvedValue(
'https://backstage.example.com/api/techdocs',
);
techdocsStorageApi.getBaseUrl.mockResolvedValue(
`https://backstage.example.com/api/techdocs/${entityName.namespace}/${entityName.kind}/${entityName.name}/${this.options.path}`,
);
techdocsStorageApi.getEntityDocs.mockResolvedValue(
renderToStaticMarkup(this.options.dom || defaultDom),
);