16073: Rename process io panel tabs
[arvados-workbench2.git] / src / components / refresh-button / refresh-button.test.tsx
index f6372e5c64adb98acc0c98998b61e3302c91f1ae..3a9292e6ff703c9130465c7578af6ef00b183c13 100644 (file)
@@ -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('<RefreshButton />', () => {
     beforeEach(() => {
         props = {
             history: {
-                push: jest.fn(),
+                replace: jest.fn(),
             },
             classes: {},
         };
@@ -31,6 +31,7 @@ describe('<RefreshButton />', () => {
     });
 
     it('should pass window location to router', () => {
+        expect(localStorage.getItem(LAST_REFRESH_TIMESTAMP)).toBeFalsy();
         // setup
         const wrapper = shallow(<RefreshButton {...props} />);
 
@@ -38,6 +39,7 @@ describe('<RefreshButton />', () => {
         wrapper.find(Button).simulate('click');
 
         // then
-        expect(props.history.push).toHaveBeenCalledWith('/');
+        expect(props.history.replace).toHaveBeenCalledWith('/');
+        expect(localStorage.getItem(LAST_REFRESH_TIMESTAMP)).not.toBeFalsy();
     });
 });