Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test for action.js #69

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/components/atoms/LanguageProvider/tests/action.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { changeLocale } from '../actions';
import { CHANGE_LOCALE } from '../constants';

// Test suite for the changeLocale action creator
describe('changeLocale action creator', () => {
it('should create an action to change the locale', () => {
const languageLocale = 'en';
himanshu-wedensday marked this conversation as resolved.
Show resolved Hide resolved
const expectedAction = {
type: CHANGE_LOCALE,
locale: languageLocale
};
const action = changeLocale(languageLocale);
expect(action).toEqual(expectedAction);
});
});
6 changes: 1 addition & 5 deletions app/scenes/RootScreen/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import { connect } from 'react-redux';
import { PropTypes } from 'prop-types';
import NavigationService from '@services/NavigationService';
import AppNavigator from '@navigators/AppNavigator';
import Container from '@atoms/Container';

import { rootScreenActions } from './reducer';
import React, { useEffect } from 'react';
import setRefForTopLevelNavigtor from '@app/services/NavigationService';

const RootScreen = props => {
useEffect(() => {
// Run the startup function when the component mounts
props.startup();
}, []);

const setRefForTopLevelNavigtor = navigatorRef => {
NavigationService.setTopLevelNavigator(navigatorRef);
};

return (
<Container testID="root-screen">
<AppNavigator ref={setRefForTopLevelNavigtor} />
Expand Down