Skip to content

Commit

Permalink
add more tests to components folder
Browse files Browse the repository at this point in the history
  • Loading branch information
cescoferraro committed May 17, 2022
1 parent 5db25e1 commit 49830b1
Show file tree
Hide file tree
Showing 24 changed files with 2,287 additions and 899 deletions.
1,968 changes: 1,152 additions & 816 deletions web/package-lock.json

Large diffs are not rendered by default.

129 changes: 64 additions & 65 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,37 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@emotion/react": "^11.9.0",
"@reactour/tour": "^2.10.3",
"@reduxjs/toolkit": "^1.7.2",
"@sentry/react": "^6.19.7",
"@sentry/tracing": "^6.19.7",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"@types/d3": "^7.1.0",
"@types/jest": "^24.9.1",
"@types/node": "^12.20.43",
"@types/react": "^16.14.22",
"@types/react-dom": "^16.9.14",
"@types/react-redux": "^7.1.22",
"antd": "^4.18.5",
"d3": "^7.3.0",
"d3-dag": "^0.9.1",
"date-fns": "^2.28.0",
"ga-4-react": "^0.1.281",
"jmespath": "^0.16.0",
"lodash": "^4.17.21",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-flow-renderer": "^9.7.3",
"react-intersection-observer": "^9.1.0",
"react-json-pretty": "^2.2.0",
"react-redux": "^7.2.6",
"react-reflex": "^4.0.3",
"react-router-dom": "^6.2.1",
"@ant-design/icons": "4.7.0",
"@emotion/react": "11.9.0",
"@reactour/tour": "2.10.3",
"@reduxjs/toolkit": "1.7.2",
"@sentry/react": "6.19.7",
"@sentry/tracing": "6.19.7",
"@testing-library/jest-dom": "4.2.4",
"@testing-library/react": "9.5.0",
"@testing-library/user-event": "7.2.1",
"@types/d3": "7.1.0",
"@types/jest": "24.9.1",
"@types/node": "12.20.43",
"@types/react": "16.14.22",
"@types/react-dom": "16.9.14",
"@types/react-redux": "7.1.22",
"antd": "4.20.4",
"d3": "7.3.0",
"d3-dag": "0.9.1",
"date-fns": "2.28.0",
"ga-4-react": "0.1.281",
"jmespath": "0.16.0",
"lodash": "4.17.21",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-flow-renderer": "9.7.3",
"react-json-view": "1.21.3",
"react-redux": "7.2.6",
"react-reflex": "4.0.3",
"react-router-dom": "6.2.1",
"react-scripts": "5.0.1",
"styled-components": "^5.3.3",
"styled-components": "5.3.3",
"typescript": "~4.1.5"
},
"scripts": {
Expand Down Expand Up @@ -85,42 +84,42 @@
"resetMocks": false
},
"resolutions": {
"styled-components": "^5"
"styled-components": "5"
},
"devDependencies": {
"@craco/craco": "^6.4.3",
"@cypress/react": "^5.12.4",
"@cypress/webpack-dev-server": "^1.8.4",
"@faker-js/faker": "^6.3.1",
"@storybook/addon-actions": "^6.4.22",
"@storybook/addon-essentials": "^6.4.22",
"@storybook/addon-interactions": "^6.4.22",
"@storybook/addon-links": "^6.4.22",
"@storybook/builder-webpack5": "^6.4.22",
"@storybook/manager-webpack5": "^6.4.22",
"@storybook/node-logger": "^6.4.22",
"@storybook/preset-ant-design": "^0.0.2",
"@storybook/preset-create-react-app": "^4.1.0",
"@storybook/react": "^6.4.22",
"@storybook/testing-library": "^0.0.11",
"@testing-library/react-hooks": "^8.0.0",
"@types/jmespath": "^0.15.0",
"@types/lodash": "^4.14.181",
"@types/styled-components": "^5.1.21",
"craco-less": "^2.0.0",
"cypress": "^9.6.0",
"eslint": "^8.8.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-unused-imports": "^2.0.0",
"jest-fetch-mock": "^3.0.3",
"prettier": "^2.5.1",
"webpack": "^5.72.0"
"@craco/craco": "6.4.3",
"@cypress/react": "5.12.4",
"@cypress/webpack-dev-server": "1.8.4",
"@faker-js/faker": "6.3.1",
"@storybook/addon-actions": "6.4.22",
"@storybook/addon-essentials": "6.4.22",
"@storybook/addon-interactions": "6.4.22",
"@storybook/addon-links": "6.4.22",
"@storybook/builder-webpack5": "6.4.22",
"@storybook/manager-webpack5": "6.4.22",
"@storybook/node-logger": "6.4.22",
"@storybook/preset-ant-design": "0.0.2",
"@storybook/preset-create-react-app": "4.1.0",
"@storybook/react": "6.4.22",
"@storybook/testing-library": "0.0.11",
"@testing-library/react-hooks": "8.0.0",
"@types/jmespath": "0.15.0",
"@types/lodash": "4.14.181",
"@types/styled-components": "5.1.21",
"craco-less": "2.0.0",
"cypress": "9.6.0",
"eslint": "8.8.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-react": "7.28.0",
"eslint-plugin-react-hooks": "4.3.0",
"eslint-plugin-unused-imports": "2.0.0",
"jest-fetch-mock": "3.0.3",
"prettier": "2.5.1",
"webpack": "5.72.0"
},
"proxy": "http://localhost:8080"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {render} from '@testing-library/react';
import {MemoryRouter} from 'react-router-dom';
import CreateTestModal from '../CreateTestModal';
import {ReduxWrapperProvider} from '../../../redux/ReduxWrapperProvider';

test('CreateTestModal', () => {
const result = render(
<MemoryRouter>
<ReduxWrapperProvider>
<CreateTestModal visible onClose={jest.fn()} />
</ReduxWrapperProvider>
</MemoryRouter>
);
expect(result.container).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CreateTestModal 1`] = `
<div>
<div
class="sc-bdvvtL gmMIqV"
/>
</div>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {render} from '@testing-library/react';
import ErrorBoundary from '../ErrorBoundary';

test('ErrorBoundary', () => {
const result = render(<ErrorBoundary error={{message: '', stack: '', name: 'sdfk'}} />);
expect(result.container).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ErrorBoundary 1`] = `
<div>
<div
class="sc-bdvvtL mLXGX"
>
<span
aria-label="close-circle"
class="anticon anticon-close-circle"
role="img"
style="color: red; font-size: 32px;"
>
<svg
aria-hidden="true"
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"
/>
</svg>
</span>
<h2
class="ant-typography"
>
Something went wrong!
</h2>
<div
style="display: flex; max-width: 800px; padding: 24px;"
>
[object Object]
</div>
</div>
</div>
`;
15 changes: 15 additions & 0 deletions web/src/components/FailedTrace/__tests__/FailedTrace.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {render} from '@testing-library/react';
import {MemoryRouter} from 'react-router-dom';
import FailedTrace from '../index';
import {ReduxWrapperProvider} from '../../../redux/ReduxWrapperProvider';

test('FailedTrace', () => {
const result = render(
<MemoryRouter>
<ReduxWrapperProvider>
<FailedTrace onRunTest={jest.fn()} testId="234" isDisplayingError onEdit={jest.fn()} />
</ReduxWrapperProvider>
</MemoryRouter>
);
expect(result.container).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`FailedTrace 1`] = `
<div>
<div
class="sc-bdvvtL mLXGX"
>
<div
class="sc-gsDKAQ hUQIyF"
>
<span
aria-label="close-circle"
class="anticon anticon-close-circle sc-dkPtRN ikUQFp"
role="img"
style="color: rgb(232, 71, 73); font-size: 32px;"
>
<svg
aria-hidden="true"
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"
/>
</svg>
</span>
<div
class="sc-gsDKAQ sc-hKwDye hUQIyF ctlTiW"
>
<h3
class="ant-typography"
>
Test Run Failed
</h3>
<span
class="ant-typography ant-typography-secondary"
>
Information explaining the state the test failed at.
</span>
<span
class="ant-typography ant-typography-secondary"
>
Please let us know about this issue -
<a
href="https://github.com/kubeshop/tracetest/issues/new/choose"
>
create an issue
</a>
or contact us via
<a
href="https://discord.gg/6zupCZFQbe"
>
Discord
</a>
.
</span>
<span
class="ant-typography ant-typography-secondary"
>
We will check it out and respond to you.
</span>
</div>
<div
class="sc-eCImPb hBTGvO"
>
<button
class="ant-btn ant-btn-primary ant-btn-background-ghost"
type="button"
>
<span>
Edit Test
</span>
</button>
<button
class="ant-btn ant-btn-primary ant-btn-background-ghost"
type="button"
>
<span>
Rerun Test
</span>
</button>
</div>
</div>
</div>
</div>
`;
12 changes: 12 additions & 0 deletions web/src/components/Header/__tests__/Header.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {render} from '@testing-library/react';
import {MemoryRouter} from 'react-router-dom';
import Header from '../index';

test('Header', () => {
const result = render(
<MemoryRouter>
<Header />
</MemoryRouter>
);
expect(result.container).toMatchSnapshot();
});
Loading

0 comments on commit 49830b1

Please sign in to comment.