Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cescoferraro committed May 31, 2022
1 parent 1b88db6 commit f58d11b
Show file tree
Hide file tree
Showing 27 changed files with 136 additions and 922 deletions.
3 changes: 2 additions & 1 deletion web/src/components/Diagram/components/DAG.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {useCallback, useEffect, useMemo} from 'react';
import React, {useCallback, useEffect, useMemo} from 'react';
import ReactFlow, {Background, FlowElement} from 'react-flow-renderer';
import {useDAGChart} from '../../../hooks/useDAGChart';
import TraceNode from '../../TraceNode';
Expand Down Expand Up @@ -29,6 +29,7 @@ const Diagram: React.FC<IDiagramProps> = ({trace, selectedSpan, onSelectSpan}):
);
}, [trace?.spans]);

console.log(spanMap);
const dagLayout = useDAGChart(spanMap);

const handleElementClick = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {render} from '@testing-library/react';
import ErrorBoundary from '../ErrorBoundary';

test('ErrorBoundary', () => {
const result = render(<ErrorBoundary error={new Error('cannot find value of undefined')} />);
expect(result.container).toMatchSnapshot();
const errorMsg = 'cannot find value of undefined';
const {getByText} = render(<ErrorBoundary error={new Error(errorMsg)} />);
expect(getByText('Something went wrong!')).toBeTruthy();
});

This file was deleted.

8 changes: 5 additions & 3 deletions web/src/components/FailedTrace/__tests__/FailedTrace.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import {render} from '@testing-library/react';
import {MemoryRouter} from 'react-router-dom';
import FailedTrace from '../index';
import {ReduxWrapperProvider} from '../../../redux/ReduxWrapperProvider';
import TestMock from '../../../models/__mocks__/Test.mock';

test('FailedTrace', () => {
const result = render(
const test = TestMock.model();
const {getByText} = render(
<MemoryRouter>
<ReduxWrapperProvider>
<FailedTrace onRunTest={jest.fn()} testId="234" isDisplayingError onEdit={jest.fn()} />
<FailedTrace onRunTest={jest.fn()} testId={test.id} isDisplayingError onEdit={jest.fn()} />
</ReduxWrapperProvider>
</MemoryRouter>
);
expect(result.container).toMatchSnapshot();
expect(getByText('Rerun Test')).toBeTruthy();
});

This file was deleted.

4 changes: 2 additions & 2 deletions web/src/components/Layout/__tests__/Layout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import {MemoryRouter} from 'react-router-dom';
import Layout from '../index';

test('Layout', async () => {
const {container, getByTestId} = render(
const {getByText, getByTestId} = render(
<MemoryRouter>
<Layout>
<h2>This</h2>
</Layout>
</MemoryRouter>
);
await waitFor(() => getByTestId('github-link'));
expect(container).toMatchSnapshot();
expect(getByText('This')).toBeTruthy();
});
123 changes: 0 additions & 123 deletions web/src/components/Layout/__tests__/__snapshots__/Layout.test.tsx.snap

This file was deleted.

4 changes: 2 additions & 2 deletions web/src/components/Navigation/__tests__/Navigation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jest.mock('../../../services/Analytics/Analytics.service', () => {
});

test('Router', async () => {
const {container, getByTestId} = render(
const {getByText, getByTestId} = render(
<ReduxWrapperProvider>
<Router />
</ReduxWrapperProvider>
);

await waitFor(() => getByTestId('github-link'));
expect(container).toMatchSnapshot();
expect(getByText('Documentation')).toBeTruthy();
});
Loading

0 comments on commit f58d11b

Please sign in to comment.