-
Notifications
You must be signed in to change notification settings - Fork 134
Closed
Labels
testTesting and project configurationTesting and project configuration
Milestone
Description
Two undo-redo tests are currently broken and being skipped.
em/src/shortcuts/__tests__/undo-redo.ts
Lines 188 to 245 in f68689f
| // TODO: Cursor is null in test, but correct when testing manually | |
| it.skip('cursor should restore correctly after undo archive', async () => { | |
| timer.useFakeTimer() | |
| initialize() | |
| await timer.runAllAsync() | |
| appStore.dispatch([newThought({ value: 'a' }), setCursor(['a']), { type: 'archiveThought' }, undo()]) | |
| await timer.runAllAsync() | |
| timer.useRealTimer() | |
| const stateNew = appStore.getState() | |
| const expectedCursor = [{ value: 'a', rank: 0 }] | |
| const cursorThoughts = stateNew.cursor && childIdsToThoughts(stateNew, stateNew.cursor) | |
| expect(cursorThoughts).toMatchObject(expectedCursor) | |
| }) | |
| // TODO | |
| it.skip('persists undo thought change', async () => { | |
| /** | |
| * Note: we can't use await with initialize as that results in a timeout error. It's handled using the usetestTimer from Sinon. | |
| * More on that here - https://github.com/cybersemics/em/issues/919#issuecomment-739135971. | |
| */ | |
| initialize() | |
| timer.useFakeTimer() | |
| appStore.dispatch([ | |
| importText({ | |
| text: ` | |
| - a | |
| - b`, | |
| }), | |
| setCursor(['a']), | |
| newThought({ value: 'alpha', insertNewSubthought: true }), | |
| undo(), | |
| ]) | |
| await timer.runAllAsync() | |
| timer.useRealTimer() | |
| // clear and call initialize again to reload from local db (simulating page refresh) | |
| appStore.dispatch(clear()) | |
| timer.useFakeTimer() | |
| initialize() | |
| await timer.runAllAsync() | |
| const exported = exportContext(appStore.getState(), [HOME_TOKEN], 'text/plain') | |
| const expectedOutput = `- ${HOME_TOKEN} | |
| - a | |
| - b` | |
| expect(exported).toEqual(expectedOutput) | |
| }) | |
| }) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
testTesting and project configurationTesting and project configuration