Skip to content

Commit

Permalink
Fix redo before debounce ends test
Browse files Browse the repository at this point in the history
  • Loading branch information
Skalakid committed May 8, 2024
1 parent 8393e37 commit b3b62c2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/__tests__/webInputHistory.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,13 @@ describe('debounce add history action', () => {
});

test('redo before debounce ends', () => {
const text3 = 'Hello world 3!';
const newItem3 = {text: text3, cursorPosition: text3.length};

const history = new InputHistory(depth, debounceTime);
history.setHistory(testingHistory);
history.setHistoryIndex(1);

history.debouncedAdd(newItem3.text, newItem3.cursorPosition);
history.debouncedAdd(newItem2.text, newItem2.cursorPosition);
expect(history.redo()).toEqual(null);
expect(history.getCurrentItem()).toEqual(newItem3);
expect(history.items).toEqual([testingHistory[0], testingHistory[1], newItem3]);
expect(history.getCurrentItem()).toEqual(newItem2);
expect(history.items).toEqual([testingHistory[0], testingHistory[1], newItem2]);
});
});

0 comments on commit b3b62c2

Please sign in to comment.