diff --git a/src/shortcuts/__tests__/undo.ts b/src/shortcuts/__tests__/undo.ts index fa807569b09..1274426411a 100644 --- a/src/shortcuts/__tests__/undo.ts +++ b/src/shortcuts/__tests__/undo.ts @@ -9,10 +9,10 @@ import undoShortcut from '../undo' import { initialState } from '../../util' import * as undoUtils from '../../util/isUndoEnabled' import { setCursorFirstMatchActionCreator } from '../../test-helpers/setCursorFirstMatch' -import sinonFakeTimer from '../../test-helpers/sinonFakeTimer' +import testTimer from '../../test-helpers/testTimer' import { initialize } from '../../initialize' -const fakeTimer = sinonFakeTimer() +const timer = testTimer() describe('undo shortcut', () => { const isUndoEnabled = jest.spyOn(undoUtils, 'isUndoEnabled') @@ -77,12 +77,12 @@ it('undo thought change', () => { it('persists undo thought change', async () => { /** - * Note: we can't use await with initialize as that results in a timeout error due to dexie. It's handled using the useFakeTimer from Sinon. + * Note: we can't use await with initialize as that results in a timeout error due to dexie. It's handled using the usetestTimer from Sinon. * More on that here - https://github.com/cybersemics/em/issues/919#issuecomment-739135971. */ initialize() - fakeTimer.useFakeTimer() + timer.usetimer() appStore.dispatch([ importText({ @@ -95,15 +95,15 @@ it('persists undo thought change', async () => { newThought({ value: 'alpha', insertNewSubthought: true }), { type: 'undoAction' } ] ) - await fakeTimer.runAllAsync() + await timer.runAllAsync() - fakeTimer.useRealTimer() + timer.useRealTimer() // clear and call initialize again to reload from local db (simulating page refresh) appStore.dispatch(clear()) - fakeTimer.useFakeTimer() + timer.usetimer() initialize() - await fakeTimer.runAllAsync() + await timer.runAllAsync() const exported = exportContext(appStore.getState(), [ROOT_TOKEN], 'text/plain')