Skip to content

Commit

Permalink
fix: lint issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
xobotyi committed Mar 10, 2021
1 parent e2ccb62 commit dc5bbe0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/useOrientation.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { act, renderHook } from "@testing-library/react-hooks";
import { replaceRaf } from "raf-stub";
import useOrientation from "../src/useOrientation";
import { act, renderHook } from '@testing-library/react-hooks';
import { replaceRaf } from 'raf-stub';
import useOrientation from '../src/useOrientation';

declare var requestAnimationFrame: {
reset: () => void;
Expand All @@ -18,7 +18,7 @@ describe('useOrientation', () => {
angle: 0,
};
(window.orientation as number) = 0;
})
});

afterEach(() => {
requestAnimationFrame.reset();
Expand All @@ -35,7 +35,7 @@ describe('useOrientation', () => {
function triggerOrientation(type: string, angle: number) {
(window.screen.orientation.type as string) = type;
(window.screen.orientation.angle as number) = angle;

window.dispatchEvent(new Event('orientationchange'));
}

Expand All @@ -54,7 +54,7 @@ describe('useOrientation', () => {
expect(hook.result.current.angle).toBe(0);
});

it("should re-render after orientation change on closest RAF", () => {
it('should re-render after orientation change on closest RAF', () => {
const hook = getHook();

act(() => {
Expand All @@ -70,18 +70,18 @@ describe('useOrientation', () => {
(window.screen.orientation as unknown) = undefined;

const hook = getHook();

expect(hook.result.current.type).toBe('');
expect(hook.result.current.angle).toBe(0);
});

it('should return 0 if window.orientation is not a number and if window.screen.orientation is missing', () => {
(window.screen.orientation as unknown) = undefined;
(window.orientation as unknown) = null;

const hook = getHook();

expect(hook.result.current.type).toBe('');
expect(hook.result.current.angle).toBe(0);
})
});
});

0 comments on commit dc5bbe0

Please sign in to comment.