Files
pybricks-code/src/editor/reducers.test.ts
T
David Lechner d95c550248 editor: change from ace to monaco
This replaces the ace editor with the monaco editor. It fixes quite a
few small paper-cut bugs and should be easier to add code completion
to in the future.

Many of the snippets are omitted but can be added back later if needed.
Otherwise, we have tried to preserve the existing look and feel as much
as possible.
2021-07-02 20:59:09 -05:00

28 lines
756 B
TypeScript

// SPDX-License-Identifier: MIT
// Copyright (c) 2021 The Pybricks Authors
import { monaco } from 'react-monaco-editor';
import { Action } from '../actions';
import { setEditSession } from './actions';
import reducers from './reducers';
type State = ReturnType<typeof reducers>;
test('initial state', () => {
expect(reducers(undefined, {} as Action)).toMatchInlineSnapshot(`
Object {
"current": null,
}
`);
});
test('current', () => {
const session = {} as monaco.editor.ICodeEditor;
expect(reducers({ current: null } as State, setEditSession(session)).current).toBe(
session,
);
expect(
reducers({ current: session } as State, setEditSession(undefined)).current,
).toBe(null);
});