X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/cdd2d0222b4a0d7d2b6e0cf27ca3951d7d89a8c1..4f88234088269faa064da9459376c3af2a740a7d:/src/components/refresh-button/refresh-button.test.tsx diff --git a/src/components/refresh-button/refresh-button.test.tsx b/src/components/refresh-button/refresh-button.test.tsx index f6372e5c..3a9292e6 100644 --- a/src/components/refresh-button/refresh-button.test.tsx +++ b/src/components/refresh-button/refresh-button.test.tsx @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from "react"; +import React from "react"; import { Button } from "@material-ui/core"; import { shallow, configure } from "enzyme"; -import * as Adapter from "enzyme-adapter-react-16"; -import { RefreshButton } from './refresh-button'; +import Adapter from "enzyme-adapter-react-16"; +import { LAST_REFRESH_TIMESTAMP, RefreshButton } from './refresh-button'; configure({ adapter: new Adapter() }); @@ -16,7 +16,7 @@ describe('', () => { beforeEach(() => { props = { history: { - push: jest.fn(), + replace: jest.fn(), }, classes: {}, }; @@ -31,6 +31,7 @@ describe('', () => { }); it('should pass window location to router', () => { + expect(localStorage.getItem(LAST_REFRESH_TIMESTAMP)).toBeFalsy(); // setup const wrapper = shallow(); @@ -38,6 +39,7 @@ describe('', () => { wrapper.find(Button).simulate('click'); // then - expect(props.history.push).toHaveBeenCalledWith('/'); + expect(props.history.replace).toHaveBeenCalledWith('/'); + expect(localStorage.getItem(LAST_REFRESH_TIMESTAMP)).not.toBeFalsy(); }); });