dialog.test.tsx 651 B

1234567891011121314151617181920212223
  1. /* eslint-disable import/no-extraneous-dependencies */
  2. /* eslint-disable no-undef */
  3. import React from 'react';
  4. import { render, cleanup } from '@testing-library/react';
  5. import '@testing-library/jest-dom';
  6. import Dialog from '../components/Dialog';
  7. describe('Dialog component', () => {
  8. afterEach(cleanup);
  9. test('check open status', () => {
  10. const { getByText } = render(<Dialog open>content</Dialog>);
  11. expect(getByText('content')).toBeVisible();
  12. });
  13. test('check close status', () => {
  14. const { queryByText } = render(<Dialog open={false}>content</Dialog>);
  15. expect(queryByText('content')).not.toBeInTheDocument();
  16. });
  17. });