fix breaking changes for user-event v14

This commit is contained in:
David Lechner
2022-06-02 18:45:28 -05:00
committed by David Lechner
parent 4299b36e6c
commit 883807b4b4
21 changed files with 289 additions and 280 deletions
+5 -5
View File
@@ -7,7 +7,7 @@ import Toolbar from './Toolbar';
describe('toolbar', () => {
it('should have bluetooth button', () => {
const [toolbar] = testRender(<Toolbar />);
const [, toolbar] = testRender(<Toolbar />);
const runButton = toolbar.getByRole('button', { name: 'Bluetooth' });
@@ -15,7 +15,7 @@ describe('toolbar', () => {
});
it('should have flash button', () => {
const [toolbar] = testRender(<Toolbar />);
const [, toolbar] = testRender(<Toolbar />);
const runButton = toolbar.getByRole('button', { name: 'Flash' });
@@ -23,7 +23,7 @@ describe('toolbar', () => {
});
it('should have run button', () => {
const [toolbar] = testRender(<Toolbar />);
const [, toolbar] = testRender(<Toolbar />);
const runButton = toolbar.getByRole('button', { name: 'Run' });
@@ -31,7 +31,7 @@ describe('toolbar', () => {
});
it('should have stop button', () => {
const [toolbar] = testRender(<Toolbar />);
const [, toolbar] = testRender(<Toolbar />);
const runButton = toolbar.getByRole('button', { name: 'Stop' });
@@ -39,7 +39,7 @@ describe('toolbar', () => {
});
it('should have repl button', () => {
const [toolbar] = testRender(<Toolbar />);
const [, toolbar] = testRender(<Toolbar />);
const runButton = toolbar.getByRole('button', { name: 'REPL' });
@@ -11,12 +11,12 @@ afterEach(() => {
cleanup();
});
it('should dispatch action when clicked', () => {
const [button, dispatch] = testRender(
it('should dispatch action when clicked', async () => {
const [user, button, dispatch] = testRender(
<BluetoothButton id="test-bluetooth-button" />,
);
button.getByRole('button', { name: 'Bluetooth' }).click();
await user.click(button.getByRole('button', { name: 'Bluetooth' }));
expect(dispatch).toHaveBeenCalledWith(toggleBluetooth());
});
@@ -11,10 +11,10 @@ afterEach(() => {
cleanup();
});
it('should dispatch action when clicked', () => {
const [button, dispatch] = testRender(<FlashButton id="test-flash-button" />);
it('should dispatch action when clicked', async () => {
const [user, button, dispatch] = testRender(<FlashButton id="test-flash-button" />);
button.getByRole('button', { name: 'Flash' }).click();
await user.click(button.getByRole('button', { name: 'Flash' }));
expect(dispatch).toHaveBeenCalledWith(flashFirmware(null, false, ''));
});
+3 -3
View File
@@ -12,12 +12,12 @@ afterEach(() => {
cleanup();
});
it('should dispatch action when clicked', () => {
const [button, dispatch] = testRender(<ReplButton id="test-repl-button" />, {
it('should dispatch action when clicked', async () => {
const [user, button, dispatch] = testRender(<ReplButton id="test-repl-button" />, {
hub: { runtime: HubRuntimeState.Idle },
});
button.getByRole('button', { name: 'REPL' }).click();
await user.click(button.getByRole('button', { name: 'REPL' }));
expect(dispatch).toHaveBeenCalledWith(repl());
});
+3 -3
View File
@@ -12,13 +12,13 @@ afterEach(() => {
cleanup();
});
it('should dispatch action when clicked', () => {
const [button, dispatch] = testRender(<RunButton id="test-run-button" />, {
it('should dispatch action when clicked', async () => {
const [user, button, dispatch] = testRender(<RunButton id="test-run-button" />, {
editor: { isReady: true },
hub: { runtime: HubRuntimeState.Idle },
});
button.getByRole('button', { name: 'Run' }).click();
await user.click(button.getByRole('button', { name: 'Run' }));
expect(dispatch).toHaveBeenCalledWith(downloadAndRun());
});
+3 -3
View File
@@ -12,12 +12,12 @@ afterEach(() => {
cleanup();
});
it('should dispatch action when clicked', () => {
const [button, dispatch] = testRender(<StopButton id="test-stop-button" />, {
it('should dispatch action when clicked', async () => {
const [user, button, dispatch] = testRender(<StopButton id="test-stop-button" />, {
hub: { runtime: HubRuntimeState.Running },
});
button.getByRole('button', { name: 'Stop' }).click();
await user.click(button.getByRole('button', { name: 'Stop' }));
expect(dispatch).toHaveBeenCalledWith(stop());
});