add some cell type tests

This commit is contained in:
Elliot DeNolf
2020-10-08 05:50:07 -04:00
parent 352dfa9a09
commit 3dc9ddcb52
3 changed files with 35 additions and 2 deletions

View File

@@ -3,4 +3,8 @@ module.exports = {
testTimeout: 15000, testTimeout: 15000,
testRegex: '(/src/client/.*\\.(test|spec))\\.[jt]sx?$', testRegex: '(/src/client/.*\\.(test|spec))\\.[jt]sx?$',
setupFilesAfterEnv: ['<rootDir>/tests/client/globalSetup.js'], setupFilesAfterEnv: ['<rootDir>/tests/client/globalSetup.js'],
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/src/mocks/fileMock.js',
'\\.(css|scss)$': '<rootDir>/src/mocks/emptyModule.js',
},
}; };

View File

@@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import { render } from '@testing-library/react'; import { render } from '@testing-library/react';
import Separator from './components/elements/Paginator/Separator'; import Separator from './Paginator/Separator';
describe('Components', () => { describe('Elements', () => {
describe('Paginator', () => { describe('Paginator', () => {
it('separator - renders dash', () => { it('separator - renders dash', () => {
const { getByText } = render(<Separator />); const { getByText } = render(<Separator />);

View File

@@ -0,0 +1,29 @@
import React from 'react';
import { render } from '@testing-library/react';
import DateCell from './types/Date';
import Checkbox from './types/Checkbox';
describe('Cell Types', () => {
describe('Date', () => {
it('renders date', () => {
const timeStamp = '2020-10-06T14:07:39.033Z';
const { getByText } = render(<DateCell data={timeStamp} />);
const linkElement = getByText(/October 6th 2020, 10:07 AM/i);
expect(linkElement).toBeInTheDocument();
});
});
describe('Checkbox', () => {
it('renders true', () => {
const { getByText } = render(<Checkbox data />);
const linkElement = getByText(/true/i);
expect(linkElement).toBeInTheDocument();
});
it('renders false', () => {
const { getByText } = render(<Checkbox data={false} />);
const linkElement = getByText(/false/i);
expect(linkElement).toBeInTheDocument();
});
});
});