tests(techdocs-modules): fix errors in the test

Signed-off-by: secustor <sebastian@poxhofer.at>
This commit is contained in:
secustor
2025-02-21 12:45:15 +01:00
parent 83cebff092
commit 5877409e33
3 changed files with 14 additions and 0 deletions
@@ -43,6 +43,7 @@
"@backstage/core-plugin-api": "workspace:^",
"@backstage/integration": "workspace:^",
"@backstage/integration-react": "workspace:^",
"@backstage/plugin-catalog-react": "workspace:^",
"@backstage/plugin-techdocs-react": "workspace:^",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
@@ -19,13 +19,24 @@ import { TechDocsAddonTester } from '@backstage/plugin-techdocs-addons-test-util
import React from 'react';
import { LightBox } from '../plugin';
import { entityPresentationApiRef } from '@backstage/plugin-catalog-react';
describe('LightBox', () => {
const entityPresentationApiMock = {
forEntity: jest.fn(),
};
entityPresentationApiMock.forEntity.mockReturnValue({
snapshot: {
primaryTitle: 'Test Entity',
},
});
it('renders without exploding', async () => {
const { getByText } = await TechDocsAddonTester.buildAddonsInTechDocs([
<LightBox />,
])
.withDom(<body>TEST_CONTENT</body>)
.withApis([[entityPresentationApiRef, entityPresentationApiMock]])
.renderWithEffects();
expect(getByText('TEST_CONTENT')).toBeInTheDocument();
@@ -42,6 +53,7 @@ describe('LightBox', () => {
alt="dog"
/>,
)
.withApis([[entityPresentationApiRef, entityPresentationApiMock]])
.renderWithEffects();
expect(getByTestId('fixture').onclick).not.toBeUndefined();
+1
View File
@@ -8115,6 +8115,7 @@ __metadata:
"@backstage/core-plugin-api": "workspace:^"
"@backstage/integration": "workspace:^"
"@backstage/integration-react": "workspace:^"
"@backstage/plugin-catalog-react": "workspace:^"
"@backstage/plugin-techdocs-addons-test-utils": "workspace:^"
"@backstage/plugin-techdocs-react": "workspace:^"
"@backstage/test-utils": "workspace:^"