Skip to content

Commit

Permalink
feat: created CustomRegisterField.test.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
mirovladimitrovski committed Jun 1, 2023
1 parent 6439861 commit 39efcd0
Show file tree
Hide file tree
Showing 2 changed files with 2,067 additions and 0 deletions.
59 changes: 59 additions & 0 deletions src/components/CustomRegisterField/CustomRegisterField.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react';
import { render } from '@testing-library/react';

import CustomRegisterField from './CustomRegisterField';

import { ConsentFieldVariants } from '#src/services/inplayer.account.service';

describe('<CustomRegisterField>', () => {
test('renders and matches snapshot <Checkbox>', () => {
const { container } = render(<CustomRegisterField type={ConsentFieldVariants.CHECKBOX} label="label" name="name" value="value" onChange={vi.fn()} />);

expect(container).toMatchSnapshot();
});

test('renders and matches snapshot <TextField>', () => {
const { container } = render(<CustomRegisterField type={ConsentFieldVariants.INPUT} label="label" name="name" value="value" onChange={vi.fn()} />);

expect(container).toMatchSnapshot();
});

test('renders and matches snapshot <Radio>', () => {
const { container } = render(<CustomRegisterField type={ConsentFieldVariants.RADIO} label="label" name="name" value="value" onChange={vi.fn()} />);

expect(container).toMatchSnapshot();
});

test('renders and matches snapshot <Dropdown type="select">', () => {
const { container } = render(<CustomRegisterField type={ConsentFieldVariants.GENERAL_SELECT} label="label" name="name" value="value" onChange={vi.fn()} />);

expect(container).toMatchSnapshot();
});

test('renders and matches snapshot <Dropdown type="country">', () => {
const { container } = render(<CustomRegisterField type={ConsentFieldVariants.COUNTRY_SELECT} label="label" name="name" value="value" onChange={vi.fn()} />);

expect(container).toMatchSnapshot();
});

test('renders and matches snapshot <Dropdown type="us_state">', () => {
const { container } = render(
<CustomRegisterField type={ConsentFieldVariants.US_STATE_SELECT} label="label" name="name" value="value" onChange={vi.fn()} />,
);

expect(container).toMatchSnapshot();
});

test('renders and matches snapshot <Dropdown type="datepicker">', () => {
const { container } = render(<CustomRegisterField type={ConsentFieldVariants.DATE_PICKER} label="label" name="name" value="value" onChange={vi.fn()} />);

expect(container).toMatchSnapshot();
});

test('renders and matches snapshot <Dropdown type="randomstring">', () => {
// @ts-ignore
const { container } = render(<CustomRegisterField type="randomstring" label="label" name="name" value="value" onChange={vi.fn()} />);

expect(container).toMatchSnapshot();
});
});
Loading

0 comments on commit 39efcd0

Please sign in to comment.