[GH-837]: Add unit tests for topBar (#1751)
* chore[GH-#837]: Add unit tests for topBar * fix: eslint error for screen * fix: none * fix: none and snapshot...
This commit is contained in:
parent
69b8641534
commit
6741b0e07e
2 changed files with 91 additions and 0 deletions
58
webapp/src/components/__snapshots__/topBar.test.tsx.snap
Normal file
58
webapp/src/components/__snapshots__/topBar.test.tsx.snap
Normal file
|
@ -0,0 +1,58 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`src/components/topBar should match snapshot for focalboardPlugin 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="TopBar"
|
||||
>
|
||||
<a
|
||||
class="link"
|
||||
href="https://www.focalboard.com/fwlink/feedback-boards.html?v=1.0.0"
|
||||
rel="noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
Give Feedback
|
||||
</a>
|
||||
<div
|
||||
class="versionFrame"
|
||||
>
|
||||
<div
|
||||
class="version"
|
||||
>
|
||||
v1.0.0
|
||||
</div>
|
||||
<div
|
||||
class="versionBadge"
|
||||
>
|
||||
BETA
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`src/components/topBar should match snapshot for none focalboardPlugin 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="TopBar"
|
||||
>
|
||||
<a
|
||||
class="link"
|
||||
href="https://www.focalboard.com/fwlink/feedback-focalboard.html?v=1.0.0"
|
||||
rel="noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
Give Feedback
|
||||
</a>
|
||||
<a
|
||||
href="https://www.focalboard.com/guide/user?utm_source=webapp"
|
||||
rel="noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
<i
|
||||
class="CompassIcon icon-help-circle-outline HelpIcon"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
33
webapp/src/components/topBar.test.tsx
Normal file
33
webapp/src/components/topBar.test.tsx
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
import {render} from '@testing-library/react'
|
||||
import React from 'react'
|
||||
import {mocked} from 'ts-jest/utils'
|
||||
|
||||
import {wrapDNDIntl} from '../testUtils'
|
||||
import {Constants} from '../constants'
|
||||
import {Utils} from '../utils'
|
||||
|
||||
import TopBar from './topBar'
|
||||
|
||||
Object.defineProperty(Constants, 'versionString', {value: '1.0.0'})
|
||||
jest.mock('../utils')
|
||||
const mockedUtils = mocked(Utils, true)
|
||||
|
||||
describe('src/components/topBar', () => {
|
||||
beforeEach(jest.resetAllMocks)
|
||||
test('should match snapshot for focalboardPlugin', () => {
|
||||
mockedUtils.isFocalboardPlugin.mockReturnValue(true)
|
||||
const {container} = render(wrapDNDIntl(
|
||||
<TopBar/>,
|
||||
))
|
||||
expect(container).toMatchSnapshot()
|
||||
})
|
||||
test('should match snapshot for none focalboardPlugin', () => {
|
||||
mockedUtils.isFocalboardPlugin.mockReturnValue(false)
|
||||
const {container} = render(wrapDNDIntl(
|
||||
<TopBar/>,
|
||||
))
|
||||
expect(container).toMatchSnapshot()
|
||||
})
|
||||
})
|
Loading…
Reference in a new issue