From ad002e73538afea8e16fdd853be1023a3c1b1b0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20CHAUVIN?= Date: Mon, 26 Sep 2022 12:26:56 +0200 Subject: [PATCH] [MOV] files --- front/views/HomeView/HomeView.test.tsx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 front/views/HomeView/HomeView.test.tsx diff --git a/front/views/HomeView/HomeView.test.tsx b/front/views/HomeView/HomeView.test.tsx new file mode 100644 index 0000000..75204c7 --- /dev/null +++ b/front/views/HomeView/HomeView.test.tsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { Provider } from 'react-redux'; +import store from '../../state/Store'; +import { fireEvent, render, screen } from '@testing-library/react-native'; + +import HomeView from './HomeView'; +import { en, fr } from '../../i18n/Translations'; + +describe('', () => { + const view = ; + + beforeEach(() => render(view)); + + it('has should display the text in default language', async () => { + expect((await screen.findAllByText(en.signoutBtn)).length).toBe(1); + }); + + it('has should display the text in the new language', async () => { + fireEvent.press(screen.getByText('Change language')); + expect(store.getState().language.value).toBe('fr'); + screen.update(view); + expect((await screen.findAllByText(fr.signoutBtn)).length).toBe(1); + }); +});