bigbuffet-rw/app/soapbox/components/__tests__/validation-checkmark.test.tsx

30 lines
1 KiB
TypeScript
Raw Normal View History

2022-06-09 10:45:09 -07:00
import React from 'react';
import { render, screen } from '../../jest/test-helpers';
import ValidationCheckmark from '../validation-checkmark';
describe('<ValidationCheckmark />', () => {
it('renders text', () => {
const text = 'some validation';
render(<ValidationCheckmark text={text} isValid />);
expect(screen.getByTestId('validation-checkmark')).toHaveTextContent(text);
});
it('uses a green check when valid', () => {
const text = 'some validation';
render(<ValidationCheckmark text={text} isValid />);
expect(screen.getByTestId('svg-icon-loader')).toHaveClass('text-success-500');
2022-06-09 12:53:03 -07:00
expect(screen.getByTestId('svg-icon-loader')).not.toHaveClass('text-gray-400');
2022-06-09 10:45:09 -07:00
});
it('uses a gray check when valid', () => {
const text = 'some validation';
render(<ValidationCheckmark text={text} isValid={false} />);
2022-06-09 12:53:03 -07:00
expect(screen.getByTestId('svg-icon-loader')).toHaveClass('text-gray-400');
2022-06-09 10:45:09 -07:00
expect(screen.getByTestId('svg-icon-loader')).not.toHaveClass('text-success-500');
});
});