Spaces:
Sleeping
Sleeping
File size: 1,850 Bytes
13555f3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react'
import {MockStoreEnhanced} from 'redux-mock-store'
import {Provider as ReduxProvider} from 'react-redux'
import {render} from '@testing-library/react'
import {createMemoryHistory, History} from 'history'
import {Router} from 'react-router-dom'
import {Team} from '../../store/teams'
import {TestBlockFactory} from '../../test/testBlockFactory'
import {mockStateStore, wrapDNDIntl} from '../../testUtils'
import BoardSwitcherDialog from './boardSwitcherDialog'
describe('component/BoardSwitcherDialog', () => {
const team1: Team = {
id: 'team-id-1',
title: 'Dunder Mifflin',
signupToken: '',
updateAt: 0,
modifiedBy: 'michael-scott',
}
const team2: Team = {
id: 'team-id-2',
title: 'Michael Scott Paper Company',
signupToken: '',
updateAt: 0,
modifiedBy: 'michael-scott',
}
const me = TestBlockFactory.createUser()
const state = {
users: {
me,
},
teams: {
allTeams: [team1, team2],
current: team1,
},
}
let store: MockStoreEnhanced<unknown, unknown>
let history: History
beforeEach(() => {
store = mockStateStore([], state)
history = createMemoryHistory()
})
test('base case', () => {
const onCloseHandler = jest.fn()
const component = wrapDNDIntl(
<Router history={history}>
<ReduxProvider store={store}>
<BoardSwitcherDialog onClose={onCloseHandler}/>
</ReduxProvider>
</Router>,
)
const {container} = render(component)
expect(container).toMatchSnapshot()
})
})
|