From 432f8adff783ccad53ea13fe8b4d450b64598949 Mon Sep 17 00:00:00 2001 From: stz184 Date: Fri, 6 Nov 2020 09:53:04 +0200 Subject: [PATCH] Fixed Layout.test.js --- ui/src/Layout.test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ui/src/Layout.test.js b/ui/src/Layout.test.js index dbf39032..4262974e 100644 --- a/ui/src/Layout.test.js +++ b/ui/src/Layout.test.js @@ -7,6 +7,10 @@ import { render, screen } from '@testing-library/react' import Layout, { ADMIN_QUERY, MAPBOX_QUERY, SideMenu } from './Layout' import { MemoryRouter } from 'react-router-dom' +import * as authentication from './authentication' + +jest.mock('./authentication.js') + test('Layout component', async () => { render( @@ -18,7 +22,13 @@ test('Layout component', async () => { expect(screen.getByText('layout_content')).toBeInTheDocument() }) +afterEach(() => { + authentication.authToken.mockClear() +}) + test('Layout sidebar component', async () => { + authentication.authToken.mockImplementation(() => true) + const mockedGraphql = [ { request: {