Update alert-button.test.jsx
This commit is contained in:
@@ -3,12 +3,25 @@ import userEvent from '@testing-library/user-event';
|
|||||||
|
|
||||||
import { AlertButton } from './alert-button';
|
import { AlertButton } from './alert-button';
|
||||||
|
|
||||||
describe.todo('AlertButton', () => {
|
describe('AlertButton', () => {
|
||||||
beforeEach(() => {});
|
beforeEach(() => {});
|
||||||
|
|
||||||
afterEach(() => {});
|
afterEach(() => {});
|
||||||
|
|
||||||
it('should render an alert button', async () => {});
|
it('should render an alert button', async () => {});
|
||||||
|
|
||||||
it('should trigger an alert', async () => {});
|
it.only('should trigger an alert', async () => {
|
||||||
|
// const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {})
|
||||||
|
|
||||||
|
render(<AlertButton />);
|
||||||
|
const input = screen.getByLabelText('Message');
|
||||||
|
const button = screen.getByRole('button', { name: /trigger alert/i });
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
await userEvent.type(input, 'Hello');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Click on the button.
|
||||||
|
// Look and see if alert() was called with the message.
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user