mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 09:36:27 +00:00
add test for editor saga
This commit is contained in:
committed by
David Lechner
parent
31c3e2b52e
commit
5c3ec89e3b
@@ -0,0 +1,21 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// Copyright (c) 2020 The Pybricks Authors
|
||||
|
||||
import { Ace } from 'ace-builds';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import { AsyncSaga } from '../../test';
|
||||
import { reloadProgram } from '../actions/editor';
|
||||
import editor from './editor';
|
||||
|
||||
test('reloadProgram', async () => {
|
||||
const saga = new AsyncSaga(editor);
|
||||
|
||||
const mockEditor = mock<Ace.EditSession>();
|
||||
|
||||
saga.setState({ editor: { current: mockEditor } });
|
||||
saga.put(reloadProgram());
|
||||
|
||||
expect(mockEditor.setValue).toHaveBeenCalled();
|
||||
|
||||
await saga.end();
|
||||
});
|
||||
Reference in New Issue
Block a user