-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from eclipse-mnestix/test(SubmodelDetail)-Check…
…-carbon-footprint-submodel-visualization test(submodel detail) check carbon footprint submodel visualization
- Loading branch information
Showing
4 changed files
with
2,909 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/app/[locale]/viewer/_components/submodel/SubmodelDetail.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { screen } from '@testing-library/react'; | ||
import { expect } from '@jest/globals'; | ||
import { SubmodelDetail } from 'app/[locale]/viewer/_components/submodel/SubmodelDetail'; | ||
import testSubmodel from '../submodel/carbon-footprint/test-submodel/carbonFootprint-test.json'; | ||
import { Submodel } from '@aas-core-works/aas-core3.0-typescript/types'; | ||
import { CustomRenderReactIntl } from 'test-utils/CustomRenderReactIntl'; | ||
|
||
window.ResizeObserver = | ||
window.ResizeObserver || | ||
jest.fn().mockImplementation(() => ({ | ||
disconnect: jest.fn(), | ||
observe: jest.fn(), | ||
unobserve: jest.fn(), | ||
})); | ||
|
||
jest.mock('recharts', () => { | ||
const OriginalRechartsModule = jest.requireActual('recharts'); | ||
|
||
return { | ||
...OriginalRechartsModule, | ||
ResponsiveContainer: ({ height, children }: never) => ( | ||
<div className="recharts-responsive-container" style={{ width: 800, height }}> | ||
{children} | ||
</div> | ||
), | ||
}; | ||
}); | ||
|
||
jest.mock('next-auth', jest.fn()); | ||
|
||
describe('Submodel Detail', () => { | ||
it('should render CarbonFootprintVisualizations for irdi id', async () => { | ||
CustomRenderReactIntl( | ||
<SubmodelDetail submodel={testSubmodel['carbonFootprint-IrdiId'] as unknown as Submodel} />, | ||
); | ||
const map = screen.getByTestId('carbonFootprintVisualizations'); | ||
expect(map).toBeDefined(); | ||
expect(map).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render CarbonFootprintVisualizations for URL id', async () => { | ||
CustomRenderReactIntl( | ||
<SubmodelDetail submodel={testSubmodel['carbonFootprint-UrlId'] as unknown as Submodel} />, | ||
); | ||
const map = screen.getByTestId('carbonFootprintVisualizations'); | ||
expect(map).toBeDefined(); | ||
expect(map).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.