dialog.test.tsx 596 B

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