Skip to content

test that startSketch must have been called when play button is clicked #1824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions client/modules/IDE/components/Toolbar.unit.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const renderComponent = (extraProps = {}) => {
startSketch: jest.fn(),
startAccessibleSketch: jest.fn(),
saveProject: jest.fn(),
syncFileContent: jest.fn(),
currentUser: 'me',
originalProjectName: 'testname',

Expand Down Expand Up @@ -90,4 +91,20 @@ describe('<ToolbarComponent />', () => {
await waitFor(() => expect(props.setProjectName).not.toHaveBeenCalled());
await waitFor(() => expect(props.saveProject).not.toHaveBeenCalled());
});

it('sketch is started when play button is clicked', async () => {
const props = renderComponent();
const playButton = screen.getByLabelText('Play only visual sketch');
fireEvent.click(playButton);

await waitFor(() => expect(props.startSketch).toHaveBeenCalled());
});

it('sketch content is synched when play button is clicked', async () => {
const props = renderComponent();
const playButton = screen.getByLabelText('Play only visual sketch');
fireEvent.click(playButton);

await waitFor(() => expect(props.syncFileContent).toHaveBeenCalled());
});
});