Skip to content

Commit

Permalink
test: fix integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-musallam committed Oct 19, 2023
1 parent 340e559 commit c6c43a0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/component/1d/integral/IntegralsSeries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Integral as IntegralType } from 'nmr-processing';
import { useChartData } from '../../context/ChartContext';
import useSpectrum from '../../hooks/useSpectrum';

import { Integral } from './Integral';
import { Integration } from './Integration';

const emptyData = { integrals: {}, info: {}, display: {} };

Expand All @@ -28,7 +28,7 @@ export default function IntegralsSeries() {
return (
<g clipPath={`url(#${displayerKey}clip-chart-1d)`} className="integrals">
{integrals.values.map((integral) => (
<Integral
<Integration
nucleus={nucleus}
key={integral.id}
integral={integral}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface IntegralProps {
max: number;
}

export function Integral({ integral, nucleus, max }: IntegralProps) {
export function Integration({ integral, nucleus, max }: IntegralProps) {
const { x, y } = integral;
const { scaleRatio } = useActiveSpectrumIntegralsViewState();
const path = useIntegralPath({ x, y, max, scaleRatio });
Expand Down
2 changes: 1 addition & 1 deletion test-e2e/core/import.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ test('should load .nmrium data from version 3', async ({ page }) => {

await test.step('check integrals', async () => {
const integrals = nmrium.page.locator(
'_react=IntegralsSeries >> _react=Integral',
'_react=IntegralsSeries >> _react=Integration',
);
await expect(integrals).toHaveCount(1);
});
Expand Down
12 changes: 6 additions & 6 deletions test-e2e/panels/integral.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function addIntegral(

// Should have integral with at least 1000 points
const path = (await nmrium.page.getAttribute(
`_react=IntegralsSeries >> _react=Integral >> nth=${childIndex} >> path >> nth=0`,
`_react=IntegralsSeries >> _react=Integration >> nth=${childIndex} >> path >> nth=0`,
'd',
)) as string;
expect(path.length).toBeGreaterThan(1000);
Expand All @@ -26,7 +26,7 @@ async function addIntegral(

async function resizeIntegral(nmrium: NmriumPage) {
const rightResizer = nmrium.page.locator(
'_react=IntegralsSeries >> _react=Integral >> nth=0 >> _react=SVGResizerHandle >> nth=1',
'_react=IntegralsSeries >> _react=Integration >> nth=0 >> _react=SVGResizerHandle >> nth=1',
);

const {
Expand All @@ -46,28 +46,28 @@ async function resizeIntegral(nmrium: NmriumPage) {
await nmrium.page.mouse.up();

const path = (await nmrium.page.getAttribute(
'_react=IntegralsSeries >> _react=Integral >> nth=0 >> path >> nth=0',
'_react=IntegralsSeries >> _react=Integration >> nth=0 >> path >> nth=0',
'd',
)) as string;

expect(path.length).toBeGreaterThan(1000);
expect(path).not.toContain('NaN');

const container = nmrium.page.locator(
'_react=IntegralsSeries >> _react=Integral >> nth=0 >> rect >> nth=0',
'_react=IntegralsSeries >> _react=Integration >> nth=0 >> rect >> nth=0',
);
const { width } = (await container.boundingBox()) as BoundingBox;
expect(width).toBe(41);
}

async function deleteIntegral(nmrium: NmriumPage) {
const container = nmrium.page.locator(
'_react=IntegralsSeries >> _react=Integral >> nth=0 ',
'_react=IntegralsSeries >> _react=Integration >> nth=0 ',
);
await container.hover();
await nmrium.page.keyboard.press('Delete');
await expect(
nmrium.page.locator('_react=IntegralsSeries >> _react=Integral'),
nmrium.page.locator('_react=IntegralsSeries >> _react=Integration'),
).toHaveCount(1);
}

Expand Down

0 comments on commit c6c43a0

Please sign in to comment.