Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for react-testing-library and remove enzyme #63

Open
2 tasks
natterstefan opened this issue Nov 9, 2021 · 0 comments
Open
2 tasks
Assignees
Labels
enhancement New feature or request

Comments

@natterstefan
Copy link
Owner

natterstefan commented Nov 9, 2021

Feature Request

Remove enzyme and use react-testing-library instead.

Tasks

Example

yarn add @testing-library/react @testing-library/react-hooks @testing-library/jest-dom -D 
// Example.tsx
import React from 'react'

export const Example = () => {
  return <div data-testid="example">Example</div>
}
// Example.test.tsx
import React from 'react'
import { render, screen } from '@testing-library/react'

import { Example } from '..'

describe('Example', () => {
  it('should render', () => {
    render(<Example />)

    expect(screen.getByTestId('example')).toBeInTheDocument()
  })
})
// jest.setup.ts
// @see https://www.carlrippon.com/using-jest-and-rtl-with-react-typescript/
import '@testing-library/jest-dom'

Motivation

These days I prefer using RTL instead of Enzyme because its implementation and syntax feels more natural and "react"-like than enzymes.

@natterstefan natterstefan added the enhancement New feature or request label Nov 9, 2021
@natterstefan natterstefan self-assigned this Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant