diff --git a/ui/src/app/App.js b/ui/src/app/App.js index 36d67f773..097c0095d 100644 --- a/ui/src/app/App.js +++ b/ui/src/app/App.js @@ -26,12 +26,12 @@ import { NewProvider } from './metadata/new/NewProvider'; import { Filter } from './metadata/Filter'; import { Contention } from './metadata/contention/ContentionContext'; import { SessionModal } from './core/user/SessionModal'; -import Button from 'react-bootstrap/esm/Button'; +import Button from 'react-bootstrap/Button'; function App() { - const [showTimeout, setShowTimeout] = React.useState(); + const [showTimeout] = React.useState(); const httpOptions = { redirect: 'manual', diff --git a/ui/src/app/App.test.js b/ui/src/app/App.test.js index 1f03afeec..0b91c687f 100644 --- a/ui/src/app/App.test.js +++ b/ui/src/app/App.test.js @@ -1,8 +1,8 @@ -import { render, screen } from '@testing-library/react'; +import React from 'react'; +import ReactDOM from 'react-dom'; import App from './App'; -test('renders learn react link', () => { - render(); - const linkElement = screen.getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); -}); +it('renders without crashing', () => { + const div = document.createElement('div'); + ReactDOM.render(, div); +}); \ No newline at end of file diff --git a/ui/src/app/metadata/contention/component/ContentionModal.js b/ui/src/app/metadata/contention/component/ContentionModal.js index 1bd6e0889..73a0efef6 100644 --- a/ui/src/app/metadata/contention/component/ContentionModal.js +++ b/ui/src/app/metadata/contention/component/ContentionModal.js @@ -7,7 +7,7 @@ import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; import Translate from '../../../i18n/components/translate'; import { useTranslator } from '../../../i18n/hooks'; import { ChangeItem } from './ChangeItem'; -import Alert from 'react-bootstrap/esm/Alert'; +import Alert from 'react-bootstrap/Alert'; export function ContentionModal ({ theirs = [], ours = [], onUseTheirs, onUseOurs, ...props }) { diff --git a/ui/src/app/metadata/editor/MetadataEditorForm.js b/ui/src/app/metadata/editor/MetadataEditorForm.js index 6413cbedf..22689ff8c 100644 --- a/ui/src/app/metadata/editor/MetadataEditorForm.js +++ b/ui/src/app/metadata/editor/MetadataEditorForm.js @@ -6,7 +6,7 @@ import FormCheck from 'react-bootstrap/FormCheck'; import { fields, widgets } from '../../form/component'; import { templates } from '../../form/component'; import { useUiSchema } from '../hooks/schema'; -import Alert from 'react-bootstrap/esm/Alert'; +import Alert from 'react-bootstrap/Alert'; const invisErrors = ['const', 'oneOf'] diff --git a/ui/src/app/metadata/wizard/MetadataSourceWizard.js b/ui/src/app/metadata/wizard/MetadataSourceWizard.js index 2a5199fc2..1ac8f5bb2 100644 --- a/ui/src/app/metadata/wizard/MetadataSourceWizard.js +++ b/ui/src/app/metadata/wizard/MetadataSourceWizard.js @@ -12,9 +12,9 @@ import { removeNull } from '../../core/utility/remove_null'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; import Translate from '../../i18n/components/translate'; -import Alert from 'react-bootstrap/esm/Alert'; -import Row from 'react-bootstrap/esm/Row'; -import Col from 'react-bootstrap/esm/Col'; +import Alert from 'react-bootstrap/Alert'; +import Row from 'react-bootstrap/Row'; +import Col from 'react-bootstrap/Col'; export function MetadataSourceWizard ({ onShowNav }) { diff --git a/ui/src/setupTests.js b/ui/src/setupTests.js index 8f2609b7b..f5f96e21d 100644 --- a/ui/src/setupTests.js +++ b/ui/src/setupTests.js @@ -3,3 +3,39 @@ // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom import '@testing-library/jest-dom'; + +const localStorageMock = { + getItem: jest.fn(), + setItem: jest.fn(), + removeItem: jest.fn(), + clear: jest.fn(), +}; +global.localStorage = localStorageMock; +/* +const documentCookieMock = { + cookies: '', + + get cookie() { + return this.cookies; + }, + + set cookie(cookieValue) { + const cookies = this.cookies.split(' '); + const cookieName = cookieValue.split('=').shift(); + const cookieNameLength = cookieName.length; + let cookieIndex = -1; + cookies.forEach((value, index) => { + if (`${value.substr(0, cookieNameLength)}=` === `${cookieName}=`) { + cookieIndex = index; + } + }); + if (cookieIndex > -1) { + cookies[cookieIndex] = `${cookieValue};`; + } else { + cookies.push(`${cookieValue};`); + } + this.cookies = cookies.join(' ').trim(); + }, +}; + +global.document.cookie = documentCookieMock;*/ \ No newline at end of file