Skip to content

Commit

Permalink
fix: delete isClient
Browse files Browse the repository at this point in the history
  • Loading branch information
kodai3 committed Mar 9, 2021
1 parent f9c743f commit 72f4cb9
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions tests/useOrientation.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { act, renderHook } from '@testing-library/react-hooks';
import { replaceRaf } from 'raf-stub';
import useOrientation from '../src/useOrientation';
import { isClient } from '../src/util';
import { act, renderHook } from "@testing-library/react-hooks";
import { replaceRaf } from "raf-stub";
import useOrientation from "../src/useOrientation";

declare var requestAnimationFrame: {
reset: () => void;
Expand Down Expand Up @@ -55,17 +54,7 @@ describe('useOrientation', () => {
expect(hook.result.current.angle).toBe(0);
});

it('should use passed parameters as initial values in case of non-browser use', () => {
const hook = getHook({
angle: 90,
type: 'portrait-primary'
});

expect(hook.result.current.type).toBe(isClient ? window.screen.orientation.type : 'portrait-primary');
expect(hook.result.current.angle).toBe(isClient ? window.screen.orientation.angle : 90);
});

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 Down

0 comments on commit 72f4cb9

Please sign in to comment.