mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 10:35:11 +00:00
24 lines
661 B
TypeScript
24 lines
661 B
TypeScript
// SPDX-License-Identifier: MIT
|
|
// Copyright (c) 2022 The Pybricks Authors
|
|
|
|
import { cleanup } from '@testing-library/react';
|
|
import React from 'react';
|
|
import { testRender } from '../../../../test';
|
|
import { repl } from '../../../hub/actions';
|
|
import { HubRuntimeState } from '../../../hub/reducers';
|
|
import ReplButton from './ReplButton';
|
|
|
|
afterEach(() => {
|
|
cleanup();
|
|
});
|
|
|
|
it('should dispatch action when clicked', () => {
|
|
const [button, dispatch] = testRender(<ReplButton />, {
|
|
hub: { runtime: HubRuntimeState.Idle },
|
|
});
|
|
|
|
button.getByRole('button', { name: 'REPL' }).click();
|
|
|
|
expect(dispatch).toHaveBeenCalledWith(repl());
|
|
});
|