Simplify stubs in Quill tests

This commit is contained in:
Evan Hahn 2021-01-04 12:28:32 -06:00 committed by Scott Nonnenberg
parent 55a89699ab
commit 1b5e229f95
2 changed files with 3 additions and 15 deletions

View file

@ -9,8 +9,6 @@ import { EmojiData } from '../../../components/emoji/lib';
describe('emojiCompletion', () => {
let emojiCompletion: EmojiCompletion;
const mockOnPickEmoji = sinon.spy();
const mockSetEmojiPickerElement = sinon.spy();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let mockQuill: any;
@ -26,10 +24,8 @@ describe('emojiCompletion', () => {
updateContents: sinon.stub(),
};
const options = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onPickEmoji: mockOnPickEmoji as any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
setEmojiPickerElement: mockSetEmojiPickerElement as any,
onPickEmoji: sinon.stub(),
setEmojiPickerElement: sinon.stub(),
skinTone: 0,
};
@ -40,12 +36,6 @@ describe('emojiCompletion', () => {
emojiCompletion.render = sinon.stub();
});
afterEach(function afterEach() {
mockOnPickEmoji.resetHistory();
mockSetEmojiPickerElement.resetHistory();
(emojiCompletion.render as sinon.SinonStub).resetHistory();
});
describe('getCurrentLeafTextPartitions', () => {
it('returns left and right text', () => {
mockQuill.getSelection.returns({ index: 0, length: 0 });

View file

@ -53,8 +53,6 @@ const members: Array<ConversationType> = [
];
describe('MentionCompletion', () => {
const mockSetMentionPickerElement = sinon.spy();
let mockQuill: Omit<
Partial<{ [K in keyof Quill]: SinonStub }>,
'keyboard'
@ -72,7 +70,7 @@ describe('MentionCompletion', () => {
i18n: sinon.stub(),
me,
memberRepositoryRef,
setMentionPickerElement: mockSetMentionPickerElement,
setMentionPickerElement: sinon.stub(),
};
mockQuill = {