Open cjmling opened 2 years ago
Way 2
import { fireEvent, render, screen } from '@testing-library/react'
import React from 'react'
import FilterRange from '../../../components/filter/filter-range/filter-range'
test('loads items eventually', async () => {
const { container, getByText } = render(
<FilterRange onSearchStateChange={() => {}} facetsStats={{}} />
)
expect(container.textContent).toContain('Total Value Locked')
expect(container.textContent).toContain('APY')
// Click apy button
fireEvent.click(screen.getByText('APY'))
// Check if modal open and have filter by apy text header
expect(container.textContent).toContain('Filter by apy')
})
There seems to be multiple way of setting up the test.
Way 1