Check leaks in Mocha
This commit is contained in:
parent
7543d8b60d
commit
dc918aea1d
3 changed files with 3 additions and 38 deletions
3
.mocharc.json
Normal file
3
.mocharc.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"checkLeaks": true
|
||||
}
|
|
@ -7,9 +7,6 @@ import sinon from 'sinon';
|
|||
import { EmojiCompletion } from '../../../quill/emoji/completion';
|
||||
import { EmojiData } from '../../../components/emoji/lib';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const globalAsAny = global as any;
|
||||
|
||||
describe('emojiCompletion', () => {
|
||||
let emojiCompletion: EmojiCompletion;
|
||||
const mockOnPickEmoji = sinon.spy();
|
||||
|
@ -18,14 +15,6 @@ describe('emojiCompletion', () => {
|
|||
let mockQuill: any;
|
||||
|
||||
beforeEach(function beforeEach() {
|
||||
this.oldDocument = globalAsAny.document;
|
||||
globalAsAny.document = {
|
||||
body: {
|
||||
appendChild: () => null,
|
||||
},
|
||||
createElement: () => null,
|
||||
};
|
||||
|
||||
mockQuill = {
|
||||
getLeaf: sinon.stub(),
|
||||
getSelection: sinon.stub(),
|
||||
|
@ -55,12 +44,6 @@ describe('emojiCompletion', () => {
|
|||
mockOnPickEmoji.resetHistory();
|
||||
mockSetEmojiPickerElement.resetHistory();
|
||||
(emojiCompletion.render as sinon.SinonStub).resetHistory();
|
||||
|
||||
if (this.oldDocument === undefined) {
|
||||
delete globalAsAny.document;
|
||||
} else {
|
||||
globalAsAny.document = this.oldDocument;
|
||||
}
|
||||
});
|
||||
|
||||
describe('getCurrentLeafTextPartitions', () => {
|
|
@ -52,20 +52,6 @@ const members: Array<ConversationType> = [
|
|||
me,
|
||||
];
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace NodeJS {
|
||||
interface Global {
|
||||
document: {
|
||||
body: {
|
||||
appendChild: unknown;
|
||||
};
|
||||
createElement: unknown;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
describe('MentionCompletion', () => {
|
||||
const mockSetMentionPickerElement = sinon.spy();
|
||||
|
||||
|
@ -78,13 +64,6 @@ describe('MentionCompletion', () => {
|
|||
let mentionCompletion: MentionCompletion;
|
||||
|
||||
beforeEach(function beforeEach() {
|
||||
global.document = {
|
||||
body: {
|
||||
appendChild: sinon.spy(),
|
||||
},
|
||||
createElement: sinon.spy(),
|
||||
};
|
||||
|
||||
const memberRepositoryRef: MutableRefObject<MemberRepository> = {
|
||||
current: new MemberRepository(members),
|
||||
};
|
Loading…
Add table
Reference in a new issue