Skip to content

Commit

Permalink
🔥 Fix portal test (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
anitnilay20 authored Dec 7, 2021
1 parent 4e99c90 commit fe6d346
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions __tests__/components/Portal/Portal.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ describe('Portal', () => {
it('should not render if document in not defined', () => {
jest.useFakeTimers();

const document = global.document;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const document = (global as any).document;
global.document = undefined;
render(portal({}));

jest.runAllTimers();

global.document = document;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(global as any).document = document;
jest.runAllTimers();

expect(document.querySelector('sha-el-portal')).toBeDefined();
Expand Down

0 comments on commit fe6d346

Please sign in to comment.