diff --git a/webapp/src/components/boardTemplateSelector/boardTemplateSelector.test.tsx b/webapp/src/components/boardTemplateSelector/boardTemplateSelector.test.tsx index 460ef1057dc..8a339a6bbb0 100644 --- a/webapp/src/components/boardTemplateSelector/boardTemplateSelector.test.tsx +++ b/webapp/src/components/boardTemplateSelector/boardTemplateSelector.test.tsx @@ -13,7 +13,6 @@ import {Provider as ReduxProvider} from 'react-redux' import {MemoryRouter, Router} from 'react-router-dom' import Mutator from '../../mutator' -import {Utils} from '../../utils' import {Team} from '../../store/teams' import {createBoard, Board} from '../../blocks/board' import {IUser} from '../../user' @@ -48,7 +47,6 @@ jest.mock('../../telemetry/telemetryClient') const mockedTelemetry = mocked(TelemetryClient, true) describe('components/boardTemplateSelector/boardTemplateSelector', () => { - const mockedUtils = mocked(Utils, true) const mockedMutator = mocked(Mutator, true) const mockedOctoClient = mocked(client, true) const team1: Team = { @@ -160,9 +158,6 @@ describe('components/boardTemplateSelector/boardTemplateSelector', () => { jest.useRealTimers() }) describe('not a focalboard Plugin', () => { - beforeAll(() => { - mockedUtils.isFocalboardPlugin.mockReturnValue(false) - }) test('should match snapshot', () => { const {container} = render(wrapDNDIntl( @@ -174,9 +169,6 @@ describe('components/boardTemplateSelector/boardTemplateSelector', () => { }) }) describe('a focalboard Plugin', () => { - beforeAll(() => { - mockedUtils.isFocalboardPlugin.mockReturnValue(true) - }) test('should match snapshot', () => { const {container} = render(wrapDNDIntl( diff --git a/webapp/src/components/boardsSwitcher/boardsSwitcher.tsx b/webapp/src/components/boardsSwitcher/boardsSwitcher.tsx index 4590e6c2afd..8b5f26fd0ff 100644 --- a/webapp/src/components/boardsSwitcher/boardsSwitcher.tsx +++ b/webapp/src/components/boardsSwitcher/boardsSwitcher.tsx @@ -4,9 +4,6 @@ import React, {useEffect, useState} from 'react' import {FormattedMessage, useIntl} from 'react-intl' -import MenuWrapper from '../../widgets/menuWrapper' -import CompassIcon from '../../widgets/icons/compassIcon' -import Menu from '../../widgets/menu' import Search from '../../widgets/icons/search' import CreateCategory from '../createCategory/createCategory' import {useAppSelector} from '../../store/hooks' @@ -18,21 +15,14 @@ import { import {getCurrentCard} from '../../store/cards' import './boardsSwitcher.scss' -import AddIcon from '../../widgets/icons/add' import BoardSwitcherDialog from '../boardsSwitcherDialog/boardSwitcherDialog' import {Utils} from '../../utils' import {Constants} from '../../constants' import {TOUR_SIDEBAR, SidebarTourSteps} from '../../components/onboardingTour' -import IconButton from '../../widgets/buttons/iconButton' import SearchForBoardsTourStep from '../../components/onboardingTour/searchForBoards/searchForBoards' -type Props = { - onBoardTemplateSelectorOpen: () => void - userIsGuest?: boolean -} - -const BoardsSwitcher = (props: Props): JSX.Element => { +const BoardsSwitcher = (): JSX.Element => { const intl = useIntl() const [showSwitcher, setShowSwitcher] = useState(false) @@ -70,10 +60,6 @@ const BoardsSwitcher = (props: Props): JSX.Element => { } } - const handleCreateNewCategory = () => { - setShowCreateCategoryModal(true) - } - useEffect(() => { document.addEventListener('keydown', handleQuickSwitchKeyPress) document.addEventListener('keydown', handleEscKeyPress) diff --git a/webapp/src/components/cardDialog.test.tsx b/webapp/src/components/cardDialog.test.tsx index 4cea93c1fe6..8abe6e75e17 100644 --- a/webapp/src/components/cardDialog.test.tsx +++ b/webapp/src/components/cardDialog.test.tsx @@ -27,7 +27,6 @@ const mockedUtils = mocked(Utils, true) const mockedMutator = mocked(mutator, true) const mockedOctoClient = mocked(octoClient, true) mockedUtils.createGuid.mockReturnValue('test-id') -mockedUtils.isFocalboardPlugin.mockReturnValue(true) beforeAll(() => { mockDOM() diff --git a/webapp/src/components/shareBoard/channelPermissionsRow.test.tsx b/webapp/src/components/shareBoard/channelPermissionsRow.test.tsx index df4d769fc38..a0fec3d4cb3 100644 --- a/webapp/src/components/shareBoard/channelPermissionsRow.test.tsx +++ b/webapp/src/components/shareBoard/channelPermissionsRow.test.tsx @@ -14,7 +14,6 @@ import {Channel} from '../../store/channels' import {TestBlockFactory} from '../../test/testBlockFactory' import {mockStateStore, wrapDNDIntl} from '../../testUtils' import client from '../../octoClient' -import {Utils} from '../../utils' import ChannelPermissionsRow from './channelPermissionsRow' @@ -26,7 +25,6 @@ jest.mock('../../utils') jest.mock('../../octoClient') const mockedOctoClient = mocked(client, true) -const mockedUtils = mocked(Utils, true) const board = TestBlockFactory.createBoard() board.id = boardId @@ -80,7 +78,6 @@ describe('src/components/shareBoard/channelPermissionsRow', () => { test('should match snapshot', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(true) const store = mockStateStore([thunk], state) await act(async () => { const result = render( @@ -98,7 +95,6 @@ describe('src/components/shareBoard/channelPermissionsRow', () => { test('should match snapshot with unknown channel', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(true) mockedOctoClient.getChannel.mockResolvedValue(undefined) const store = mockStateStore([thunk], state) await act(async () => { @@ -117,7 +113,6 @@ describe('src/components/shareBoard/channelPermissionsRow', () => { test('should match snapshot with menu open', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(true) const store = mockStateStore([thunk], state) await act(async () => { const result = render( @@ -139,7 +134,6 @@ describe('src/components/shareBoard/channelPermissionsRow', () => { test('should match snapshot when no plugin mode', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(false) const store = mockStateStore([thunk], state) await act(async () => { const result = render( @@ -157,7 +151,6 @@ describe('src/components/shareBoard/channelPermissionsRow', () => { test('should match snapshot when board has no channel id', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(true) const newState = { ...state, boards: { @@ -184,7 +177,6 @@ describe('src/components/shareBoard/channelPermissionsRow', () => { test('should match snapshot in plugin mode', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(true) const store = mockStateStore([thunk], state) await act(async () => { const result = render( @@ -206,7 +198,6 @@ describe('src/components/shareBoard/channelPermissionsRow', () => { test('should match snapshot in template', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(true) const testState = { ...state, boards: { diff --git a/webapp/src/components/shareBoard/shareBoard.test.tsx b/webapp/src/components/shareBoard/shareBoard.test.tsx index 1c7774ad90c..d09f6840a0d 100644 --- a/webapp/src/components/shareBoard/shareBoard.test.tsx +++ b/webapp/src/components/shareBoard/shareBoard.test.tsx @@ -494,7 +494,6 @@ describe('src/components/shareBoard/shareBoard', () => { token: '', } mockedOctoClient.getSharing.mockResolvedValue(sharing) - mockedUtils.isFocalboardPlugin.mockReturnValue(true) mockedUtils.getUserDisplayName.mockImplementation((u) => u.username) const users: IUser[] = [ @@ -595,7 +594,6 @@ describe('src/components/shareBoard/shareBoard', () => { token: '', } mockedOctoClient.getSharing.mockResolvedValue(sharing) - mockedUtils.isFocalboardPlugin.mockReturnValue(true) let container: Element | DocumentFragment | null = null await act(async () => { @@ -670,7 +668,6 @@ describe('src/components/shareBoard/shareBoard', () => { token: '', } mockedOctoClient.getSharing.mockResolvedValue(sharing) - mockedUtils.isFocalboardPlugin.mockReturnValue(true) mockedUtils.getUserDisplayName.mockImplementation((u) => u.username) const users: IUser[] = [ diff --git a/webapp/src/components/shareBoard/teamPermissionsRow.test.tsx b/webapp/src/components/shareBoard/teamPermissionsRow.test.tsx index 14c856c4841..bb3195ec3c6 100644 --- a/webapp/src/components/shareBoard/teamPermissionsRow.test.tsx +++ b/webapp/src/components/shareBoard/teamPermissionsRow.test.tsx @@ -7,12 +7,10 @@ import thunk from 'redux-thunk' import React from 'react' import {MemoryRouter} from 'react-router' -import {mocked} from 'jest-mock' import {IUser} from '../../user' import {TestBlockFactory} from '../../test/testBlockFactory' import {mockStateStore, wrapDNDIntl} from '../../testUtils' -import {Utils} from '../../utils' import {MemberRole} from '../../blocks/board' @@ -24,8 +22,6 @@ const boardId = '1' jest.mock('../../utils') -const mockedUtils = mocked(Utils, true) - const board = TestBlockFactory.createBoard() board.id = boardId board.teamId = 'team-id' @@ -78,7 +74,6 @@ describe('src/components/shareBoard/teamPermissionsRow', () => { test('should match snapshot', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(false) const store = mockStateStore([thunk], state) await act(async () => { const result = render( @@ -100,7 +95,6 @@ describe('src/components/shareBoard/teamPermissionsRow', () => { test('should match snapshot in plugin mode', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(true) const store = mockStateStore([thunk], state) await act(async () => { const result = render( @@ -122,7 +116,6 @@ describe('src/components/shareBoard/teamPermissionsRow', () => { test('should match snapshot in template', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(true) const testState = { ...state, boards: { diff --git a/webapp/src/components/shareBoard/userPermissionsRow.test.tsx b/webapp/src/components/shareBoard/userPermissionsRow.test.tsx index e5fb89437de..f0a615eb3e8 100644 --- a/webapp/src/components/shareBoard/userPermissionsRow.test.tsx +++ b/webapp/src/components/shareBoard/userPermissionsRow.test.tsx @@ -7,14 +7,12 @@ import thunk from 'redux-thunk' import React from 'react' import {MemoryRouter} from 'react-router' -import {mocked} from 'jest-mock' import {BoardMember} from '../../blocks/board' import {IUser} from '../../user' import {TestBlockFactory} from '../../test/testBlockFactory' import {mockStateStore, wrapDNDIntl} from '../../testUtils' -import {Utils} from '../../utils' import UserPermissionsRow from './userPermissionsRow' @@ -24,8 +22,6 @@ const boardId = '1' jest.mock('../../utils') -const mockedUtils = mocked(Utils, true) - const board = TestBlockFactory.createBoard() board.id = boardId board.teamId = 'team-id' @@ -77,7 +73,6 @@ describe('src/components/shareBoard/userPermissionsRow', () => { test('should match snapshot', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(false) const store = mockStateStore([thunk], state) await act(async () => { const result = render( @@ -106,7 +101,6 @@ describe('src/components/shareBoard/userPermissionsRow', () => { test('should match snapshot-admin', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(false) const store = mockStateStore([thunk], state) const newMe = Object.assign({}, me) @@ -138,7 +132,6 @@ describe('src/components/shareBoard/userPermissionsRow', () => { test('should match snapshot in plugin mode', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(true) const store = mockStateStore([thunk], state) await act(async () => { const result = render( @@ -167,7 +160,6 @@ describe('src/components/shareBoard/userPermissionsRow', () => { test('should match snapshot in template', async () => { let container: Element | undefined - mockedUtils.isFocalboardPlugin.mockReturnValue(true) const testState = { ...state, boards: { diff --git a/webapp/src/components/sidebar/sidebar.tsx b/webapp/src/components/sidebar/sidebar.tsx index 81fde5b8c15..58cf9223b91 100644 --- a/webapp/src/components/sidebar/sidebar.tsx +++ b/webapp/src/components/sidebar/sidebar.tsx @@ -366,10 +366,7 @@ const Sidebar = (props: Props) => {
} - + { beforeEach(jest.resetAllMocks) test('should match snapshot for focalboardPlugin', () => { - mockedUtils.isFocalboardPlugin.mockReturnValue(true) const {container} = render(wrapDNDIntl( , )) expect(container).toMatchSnapshot() }) test('should match snapshot for none focalboardPlugin', () => { - mockedUtils.isFocalboardPlugin.mockReturnValue(false) const {container} = render(wrapDNDIntl( , )) diff --git a/webapp/src/components/workspace.test.tsx b/webapp/src/components/workspace.test.tsx index 1159f44ac30..c8031a4eb99 100644 --- a/webapp/src/components/workspace.test.tsx +++ b/webapp/src/components/workspace.test.tsx @@ -306,8 +306,6 @@ describe('src/components/workspace', () => { }) test('show open card tooltip', async () => { - mockedUtils.isFocalboardPlugin.mockReturnValue(true) - const welcomeBoard = TestBlockFactory.createBoard() welcomeBoard.title = 'Welcome to Boards!' @@ -519,8 +517,6 @@ describe('src/components/workspace', () => { }) test('show copy link tooltip', async () => { - mockedUtils.isFocalboardPlugin.mockReturnValue(true) - const welcomeBoard = TestBlockFactory.createBoard() welcomeBoard.title = 'Welcome to Boards!'