From 5c2a80c5c25623f0bdc4c876ce5f333a977870c3 Mon Sep 17 00:00:00 2001 From: MariaZ Date: Tue, 20 Sep 2022 10:48:31 +0200 Subject: [PATCH] Add tests for AppHelp component --- test/components/common/AppHelp.spec.js | 20 ++++++++ .../common/__snapshots__/AppHelp.spec.js.snap | 51 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 test/components/common/AppHelp.spec.js create mode 100644 test/components/common/__snapshots__/AppHelp.spec.js.snap diff --git a/test/components/common/AppHelp.spec.js b/test/components/common/AppHelp.spec.js new file mode 100644 index 0000000..ac61344 --- /dev/null +++ b/test/components/common/AppHelp.spec.js @@ -0,0 +1,20 @@ +import React from 'react' +import { render } from '@testing-library/react-native' +import AppHelp from '../../../components/common/AppHelp' + +jest.mock('react-i18next', () => ({ + useTranslation: () => ({ + t: (str, options) => { + return str + (options ? JSON.stringify(options) : '') + }, + }), +})) + +describe('AppHelp screen', () => { + test('when provided text, should render it', async () => { + const text = 'Some help test' + const { toJSON } = render() + + expect(toJSON()).toMatchSnapshot() + }) +}) diff --git a/test/components/common/__snapshots__/AppHelp.spec.js.snap b/test/components/common/__snapshots__/AppHelp.spec.js.snap new file mode 100644 index 0000000..7e73112 --- /dev/null +++ b/test/components/common/__snapshots__/AppHelp.spec.js.snap @@ -0,0 +1,51 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AppHelp screen when provided text, should render it 1`] = ` + + + * + + + Some help test + + +`;