Skip to content

Commit 7138565

Browse files
committed
Add test for createSolution action in CreateSolution component
1 parent 3e99ada commit 7138565

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/views/create-solutions/view/components/create-solution.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { IncomingMessage, OutgoingMessage } from '../../messages';
2626
import { CreationActions } from '../actions';
2727
import { CreateSolution } from './create-solution';
2828
import { act } from 'react';
29+
import { CreateSolutionState } from '../state/reducer';
2930

3031

3132

@@ -227,6 +228,19 @@ describe('CreateSolution', () => {
227228
});
228229
});
229230

231+
it('calls the createSolution creation action', async () => {
232+
await renderCreateSolution();
233+
await fillOutFormFields();
234+
await act(async () => getElements().createBtn!.click());
235+
236+
const expectedSolutionNameState: CreateSolutionState['solutionFolder'] = { hadInteraction: true, value: 'test solution' };
237+
expect(creationActions.createSolution).toHaveBeenCalledWith(
238+
expect.any(Function),
239+
expect.objectContaining({ solutionFolder: expectedSolutionNameState }),
240+
messageHandler,
241+
);
242+
});
243+
230244
it('disables interactive elements', async () => {
231245
await renderCreateSolution();
232246
await fillOutFormFields();

0 commit comments

Comments
 (0)