1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from "react";
6 import { Button } from "@material-ui/core";
7 import { shallow, configure } from "enzyme";
8 import Adapter from "enzyme-adapter-react-16";
9 import { LAST_REFRESH_TIMESTAMP, RefreshButton } from './refresh-button';
11 configure({ adapter: new Adapter() });
13 describe('<RefreshButton />', () => {
25 it('should render without issues', () => {
27 const wrapper = shallow(<RefreshButton {...props} />);
30 expect(wrapper.html()).toContain('button');
33 it('should pass window location to router', () => {
34 expect(localStorage.getItem(LAST_REFRESH_TIMESTAMP)).toBeFalsy();
36 const wrapper = shallow(<RefreshButton {...props} />);
39 wrapper.find(Button).simulate('click');
42 expect(props.history.replace).toHaveBeenCalledWith('/');
43 expect(localStorage.getItem(LAST_REFRESH_TIMESTAMP)).not.toBeFalsy();