Skip to content

Commit 481f80e

Browse files
authored
Merge pull request #1824 from vulongphan/update/add-test-for-play-button
test that startSketch must have been called when play button is clicked
2 parents 6976906 + 5c3ea47 commit 481f80e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

client/modules/IDE/components/Toolbar.unit.test.jsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const renderComponent = (extraProps = {}) => {
2222
startSketch: jest.fn(),
2323
startAccessibleSketch: jest.fn(),
2424
saveProject: jest.fn(),
25+
syncFileContent: jest.fn(),
2526
currentUser: 'me',
2627
originalProjectName: 'testname',
2728

@@ -90,4 +91,20 @@ describe('<ToolbarComponent />', () => {
9091
await waitFor(() => expect(props.setProjectName).not.toHaveBeenCalled());
9192
await waitFor(() => expect(props.saveProject).not.toHaveBeenCalled());
9293
});
94+
95+
it('sketch is started when play button is clicked', async () => {
96+
const props = renderComponent();
97+
const playButton = screen.getByLabelText('Play only visual sketch');
98+
fireEvent.click(playButton);
99+
100+
await waitFor(() => expect(props.startSketch).toHaveBeenCalled());
101+
});
102+
103+
it('sketch content is synched when play button is clicked', async () => {
104+
const props = renderComponent();
105+
const playButton = screen.getByLabelText('Play only visual sketch');
106+
fireEvent.click(playButton);
107+
108+
await waitFor(() => expect(props.syncFileContent).toHaveBeenCalled());
109+
});
93110
});

0 commit comments

Comments
 (0)