| 1 |
import '@testing-library/jest-dom'; |
| 2 |
import { screen } from '@testing-library/react'; |
| 3 |
import CustomerNotFound from '../../components/customers/CustomerNotFound'; |
| 4 |
import { renderWithProviders } from '../setup/helpers'; |
| 5 |
|
| 6 |
describe('CustomerNotFound', () => { |
| 7 |
it('renders the not found heading', () => { |
| 8 |
renderWithProviders(<CustomerNotFound />); |
| 9 |
|
| 10 |
expect(screen.getByText('Customer not found')).toBeInTheDocument(); |
| 11 |
}); |
| 12 |
|
| 13 |
it('renders the description message', () => { |
| 14 |
renderWithProviders(<CustomerNotFound />); |
| 15 |
|
| 16 |
expect( |
| 17 |
screen.getByText( |
| 18 |
"This customer doesn't exist or has no campaign order history." |
| 19 |
) |
| 20 |
).toBeInTheDocument(); |
| 21 |
}); |
| 22 |
|
| 23 |
it('renders a link back to customers list', () => { |
| 24 |
renderWithProviders(<CustomerNotFound />); |
| 25 |
|
| 26 |
const link = screen.getByText('Back to Customers'); |
| 27 |
expect(link).toBeInTheDocument(); |
| 28 |
expect(link.closest('a')).toHaveAttribute('href', '/customers'); |
| 29 |
}); |
| 30 |
}); |
| 31 |
|