Skip to content

Commit

Permalink
upgrades react-scripts + Jest + TS-Jest (#34)
Browse files Browse the repository at this point in the history
* upgrades react-scripts + Jest + TS-Jest

* fix usePageView tests
  • Loading branch information
Chris Dopuch authored Nov 5, 2019
1 parent e3dc5a5 commit 52ebbbc
Show file tree
Hide file tree
Showing 4 changed files with 3,280 additions and 2,699 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
"enzyme": "^3.7.0",
"enzyme-adapter-react-16": "^1.7.1",
"enzyme-to-json": "^3.3.5",
"jest": "^23.6.0",
"jest": "^24.9.0",
"node-thumbnail": "^0.15.0",
"prettier": "^1.14.3",
"react-scripts": "^2.1.2",
"ts-jest": "^23.10.4",
"react-scripts": "^3.2.0",
"ts-jest": "^24.1.0",
"tslint": "^5.12.0",
"tslint-config-prettier": "^1.17.0",
"typescript": "^3.2.2",
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/usePageView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ describe('usePageView', () => {
search: '?bar=0',
} as Location;

usePageView(location);
usePageView(location, {});

expect(useEffect).toBeCalled();
expect((useEffect as jest.Mock).mock.calls[0][1]).toEqual([location.pathname + location.search]);
expect((useEffect as jest.Mock).mock.calls[0][1]).toEqual([location.pathname + location.search, {}]);
});

it('should pass a callback that calls into Google Analytics', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/usePageView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export default function usePageView(location: RouteComponentProps['location'], o
...options,
});
GoogleAnalytics.pageview(page);
}, [page]); // only track the page once per mount
}, [page, options]); // only track the page once per mount
}
Loading

0 comments on commit 52ebbbc

Please sign in to comment.