fix(frontend): Fix common modal test

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2022-12-18 20:41:59 +01:00
parent 68e2a9518c
commit 2a9f692479
2 changed files with 11 additions and 2 deletions

View file

@ -95,7 +95,9 @@ exports[`CommonModal render correctly with i18nTitle 1`] = `
>
<div
class="modal-title h4"
/>
>
testTitle
</div>
</div>
testText
</div>
@ -115,7 +117,9 @@ exports[`CommonModal render correctly with title 1`] = `
>
<div
class="modal-title h4"
/>
>
testTitle
</div>
</div>
testText
</div>

View file

@ -3,6 +3,7 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import { CommonModal } from './common-modal'
import { fireEvent, render, screen } from '@testing-library/react'
import React from 'react'
@ -13,6 +14,10 @@ describe('CommonModal', () => {
jest.resetModules()
})
beforeAll(async () => {
await mockI18n()
})
it('does not render if show is false', () => {
const view = render(<CommonModal show={false}>testText</CommonModal>)
expect(view.container).toMatchSnapshot()