diff --git a/front/views/AuthenticationView.test.tsx b/front/views/AuthenticationView.test.tsx index 564593d..56ea9ff 100644 --- a/front/views/AuthenticationView.test.tsx +++ b/front/views/AuthenticationView.test.tsx @@ -1,53 +1,13 @@ import React from 'react'; -// import { Provider } from 'react-redux'; -// import { fireEvent, render, screen } from '@testing-library/react-native'; -// import store from '../state/Store'; +import { Provider } from 'react-redux'; +import TestRenderer from 'react-test-renderer'; +import store from '../state/Store'; + import AuthenticationView from '../views/AuthenticationView'; -// import { en, fr } from '../i18n/Translations'; -// import { useLanguage } from '../state/LanguageSlice'; -import renderer from 'react-test-renderer' -import { NativeBaseProvider } from "native-base"; -import Theme from '../Theme'; -// import { setUserToken } from '../state/UserSlice'; -describe('AuthenticationView Component', () => { - - jest.setTimeout(150000); - const view = () => ; - // beforeEach(() => render(view())); - - - it('view should render', () => { - const tree = renderer.create(view()).toJSON; - expect(tree).toMatchSnapshot(); - // expect(screen).toBeDefined(); +describe('', () => { + it('has 3 children', () => { + const tree = TestRenderer.create().toJSON(); + expect(tree.children.length).toBe(3); }); - - - // it('should fail', () => { - // expect(AuthenticationView.) - // }); - - // it('should render forms', async () => { - // expect(await screen.findByDisplayValue('username')).toBeTruthy(); - // }); - // it('renders the submit button', () => { - // expect(screen.findAllByText('en.signinBtn')).toBeTruthy(); - // }); - // it('renders the forms', async () => { - // expect(screen.findAllByPlaceholderText) - // }) - // const view = () => ; - - // beforeEach(() => render(view())); - - // it('has should display the text in default language', async () => { - // expect((await screen.findAllByText(en.signinBtn)).length).toBe(true); - // }); - - // it('has should display the text in the new language', async () => { - // store.dispatch(useLanguage('fr')); - // screen.update(view()); - // expect("(await screen.findAllByText(fr.signinBtn)").toBe(true); - // }); }); \ No newline at end of file diff --git a/front/views/HomeView.test.tsx b/front/views/HomeView.test.tsx index b2445c2..d5558e4 100644 --- a/front/views/HomeView.test.tsx +++ b/front/views/HomeView.test.tsx @@ -1,40 +1,13 @@ import React from 'react'; -// import { Provider } from 'react-redux'; -// import store from '../state/Store'; -// import { fireEvent, render, screen } from '@testing-library/react-native'; -import { NativeBaseProvider } from "native-base"; -import Theme from '../Theme'; - -import HomeView from './HomeView'; -// import { en, fr } from '../i18n/Translations'; -import renderer from 'react-test-renderer' +import { Provider } from 'react-redux'; +import TestRenderer from 'react-test-renderer'; +import store from '../state/Store'; +import HomeView from '../views/HomeView'; describe('', () => { - - jest.setTimeout(150000); - // const view = () => ; - // beforeEach(() => render(view())); - - // it('should render correctly', () => { - // expect(screen).toBeDefined(); - // }) - //const View = () => ; - - it('Main View should render correctly', async () => { - const tree = renderer.create().toJSON; - expect(tree).toMatchSnapshot(); + it('has 2 children', () => { + const tree = TestRenderer.create().toJSON(); + expect(tree.children.length).toBe(2); }); - - - // 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); - // }); }); diff --git a/front/views/SettingsView.test.tsx b/front/views/SettingsView.test.tsx index e088fcf..56ea9ff 100644 --- a/front/views/SettingsView.test.tsx +++ b/front/views/SettingsView.test.tsx @@ -1,32 +1,13 @@ import React from 'react'; -// import { Provider } from 'react-redux'; -// import TestRenderer from 'react-test-renderer'; -// import store from '../state/Store'; +import { Provider } from 'react-redux'; +import TestRenderer from 'react-test-renderer'; +import store from '../state/Store'; -import { Button, NativeBaseProvider } from "native-base"; -import Theme from '../Theme'; -// import { fireEvent, render, screen } from '@testing-library/react-native'; -import renderer from 'react-test-renderer' +import AuthenticationView from '../views/AuthenticationView'; -// import { MainView, PreferencesView } from './SettingsView' - -describe('testing Setting\'s main view', () => { - jest.setTimeout(150000); - const MainView = () => ; - const PreferencesView = () => ; - - it('Main View should render correctly', async () => { - const tree = renderer.create(MainView()).toJSON; - expect(tree).toMatchSnapshot(); +describe('', () => { + it('has 3 children', () => { + const tree = TestRenderer.create().toJSON(); + expect(tree.children.length).toBe(3); }); - - it('Preference View should render correctly', async () => { - const tree = renderer.create(PreferencesView()).toJSON; - expect(tree).toMatchSnapshot(); - }) - - // it('Preference View should render correctly', async() => { - // render(PreferencesView()); - // expect(screen.findAllByText('en.backBtn')).toBeTruthy(); - // }) }); \ No newline at end of file