1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from "react";
6 import { LAST_REFRESH_TIMESTAMP, RefreshButton } from './refresh-button';
8 describe('<RefreshButton />', () => {
21 replace = cy.spy(props.history, 'replace').as('replace');
24 it('should render without issues', () => {
26 cy.mount(<RefreshButton {...props} />);
29 cy.get('button').should('exist');
32 it('should pass window location to router', () => {
34 cy.mount(<RefreshButton {...props} />);
36 cy.window().then((win) => {
37 urlPath = win.location.pathname;
38 expect(!!win.localStorage.getItem(LAST_REFRESH_TIMESTAMP)).to.equal(false);
42 cy.get('button').should('exist').click();
45 cy.window().then((win) => {
46 cy.get('@replace').should('have.been.calledWith', urlPath);
47 expect(!!win.localStorage.getItem(LAST_REFRESH_TIMESTAMP)).not.to.equal(false);