diff --git a/__tests__/FooterLoading.js b/__tests__/FooterLoading.js deleted file mode 100644 index d37ee56b55..0000000000 --- a/__tests__/FooterLoading.js +++ /dev/null @@ -1,10 +0,0 @@ -import 'react-native'; -import React from 'react'; - -// Note: test renderer must be required after react-native. -import FooterLoading from '../src/components/FooterLoading'; -import { testSnapshot } from '../testUtils'; - -it('renders correctly', () => { - testSnapshot(); -}); diff --git a/__tests__/Separator.js b/__tests__/Separator.js deleted file mode 100644 index b44ad0fb24..0000000000 --- a/__tests__/Separator.js +++ /dev/null @@ -1,10 +0,0 @@ -import 'react-native'; -import React from 'react'; - -// Note: test renderer must be required after react-native. -import { Separator } from '../src/components/common'; -import { testSnapshot } from '../testUtils'; - -it('renders correctly', () => { - testSnapshot(); -}); diff --git a/__tests__/components/LoadingWheel.js b/__tests__/components/LoadingWheel.js deleted file mode 100644 index 18bf3cf535..0000000000 --- a/__tests__/components/LoadingWheel.js +++ /dev/null @@ -1,8 +0,0 @@ -import React from 'react'; - -import { testSnapshotShallow } from '../../testUtils'; -import LoadingWheel from '../../src/components/LoadingWheel'; - -it('renders correctly', () => { - testSnapshotShallow(); -}); diff --git a/package.json b/package.json index 9299466541..0162c98a7e 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "react-native-default-preference": "^1.3.1", "react-native-device-info": "^0.21.5", "react-native-fabric": "^0.5.1", - "react-native-fbsdk": "^0.7.0", + "react-native-fbsdk": "^0.8.0", "react-native-omniture": "https://github.com/CruGlobal/react-native-omniture", "react-native-parallax-scroll-view": "^0.21.0", "react-native-push-notification": "https://github.com/CruGlobal/react-native-push-notification", diff --git a/__tests__/App.js b/src/__tests__/App.js similarity index 94% rename from __tests__/App.js rename to src/__tests__/App.js index 1aa63c093f..15f2d671b7 100644 --- a/__tests__/App.js +++ b/src/__tests__/App.js @@ -6,19 +6,19 @@ import Enzyme from 'enzyme/build/index'; import { Crashlytics } from 'react-native-fabric'; import StackTrace from 'stacktrace-js'; -import App from '../src/App'; +import App from '../App'; import { EXPIRED_ACCESS_TOKEN, INVALID_ACCESS_TOKEN, INVALID_GRANT, NETWORK_REQUEST_FAILED, -} from '../src/constants'; -import * as auth from '../src/actions/auth'; -import locale from '../src/i18n/locales/en-US'; +} from '../constants'; +import * as auth from '../actions/auth'; +import locale from '../i18n/locales/en-US'; Enzyme.configure({ adapter: new Adapter() }); -jest.mock('../src/AppNavigator', () => ({ AppNavigator: 'mockAppNavigator' })); +jest.mock('../AppNavigator', () => ({ AppNavigator: 'mockAppNavigator' })); jest.mock('react-native-default-preference', () => ({ get: jest.fn().mockReturnValue(Promise.reject()), @@ -35,8 +35,8 @@ jest.mock('react-navigation-redux-helpers', () => ({ jest.mock('stacktrace-js'); -jest.mock('../src/store', () => ({ - store: require('../testUtils').createMockStore(), +jest.mock('../store', () => ({ + store: require('../../testUtils').createMockStore(), persistor: {}, })); diff --git a/__tests__/__snapshots__/storeMigrations.js.snap b/src/__tests__/__snapshots__/storeMigrations.js.snap similarity index 100% rename from __tests__/__snapshots__/storeMigrations.js.snap rename to src/__tests__/__snapshots__/storeMigrations.js.snap diff --git a/__tests__/storeMigrations.js b/src/__tests__/storeMigrations.js similarity index 87% rename from __tests__/storeMigrations.js rename to src/__tests__/storeMigrations.js index 9017a52a9c..6ac3962ea6 100644 --- a/__tests__/storeMigrations.js +++ b/src/__tests__/storeMigrations.js @@ -1,4 +1,4 @@ -import { migrations } from '../src/storeMigrations'; +import { migrations } from '../storeMigrations'; it('should migrate impact reducer to use summary key', () => { expect( diff --git a/__tests__/actions/__snapshots__/auth.js.snap b/src/actions/__tests__/__snapshots__/auth.js.snap similarity index 100% rename from __tests__/actions/__snapshots__/auth.js.snap rename to src/actions/__tests__/__snapshots__/auth.js.snap diff --git a/__tests__/actions/__snapshots__/impact.js.snap b/src/actions/__tests__/__snapshots__/impact.js.snap similarity index 100% rename from __tests__/actions/__snapshots__/impact.js.snap rename to src/actions/__tests__/__snapshots__/impact.js.snap diff --git a/__tests__/actions/__snapshots__/journey.js.snap b/src/actions/__tests__/__snapshots__/journey.js.snap similarity index 100% rename from __tests__/actions/__snapshots__/journey.js.snap rename to src/actions/__tests__/__snapshots__/journey.js.snap diff --git a/__tests__/actions/__snapshots__/notifications.js.snap b/src/actions/__tests__/__snapshots__/notifications.js.snap similarity index 100% rename from __tests__/actions/__snapshots__/notifications.js.snap rename to src/actions/__tests__/__snapshots__/notifications.js.snap diff --git a/__tests__/actions/__snapshots__/people.js.snap b/src/actions/__tests__/__snapshots__/people.js.snap similarity index 100% rename from __tests__/actions/__snapshots__/people.js.snap rename to src/actions/__tests__/__snapshots__/people.js.snap diff --git a/__tests__/actions/analytics.js b/src/actions/__tests__/analytics.js similarity index 99% rename from __tests__/actions/analytics.js rename to src/actions/__tests__/analytics.js index 9221ac20d3..11f70f0b29 100644 --- a/__tests__/actions/analytics.js +++ b/src/actions/__tests__/analytics.js @@ -12,14 +12,14 @@ import { trackActionWithoutData, trackSearchFilter, emitterCallback, -} from '../../src/actions/analytics'; +} from '../analytics'; import { ACTIONS, ANALYTICS, ANALYTICS_CONTEXT_CHANGED, CUSTOM_STEP_TYPE, LOGGED_IN, -} from '../../src/constants'; +} from '../../constants'; const mockTracker = { trackScreenView: jest.fn(), diff --git a/__tests__/actions/api.js b/src/actions/__tests__/api.js similarity index 94% rename from __tests__/actions/api.js rename to src/actions/__tests__/api.js index 1ee9a5fdf0..4391293bc4 100644 --- a/__tests__/actions/api.js +++ b/src/actions/__tests__/api.js @@ -1,17 +1,17 @@ import configureStore from 'redux-mock-store'; import thunk from 'redux-thunk'; -import callApi, { REQUESTS } from '../../src/actions/api'; -import API_CALLS from '../../src/api'; +import callApi, { REQUESTS } from '../api'; +import API_CALLS from '../../api'; import { EXPIRED_ACCESS_TOKEN, INVALID_ACCESS_TOKEN, INVALID_GRANT, UPDATE_TOKEN, -} from '../../src/constants'; -import { mockFnWithParams } from '../../testUtils'; -import * as auth from '../../src/actions/auth'; -import * as facebook from '../../src/actions/facebook'; +} from '../../constants'; +import { mockFnWithParams } from '../../../testUtils'; +import * as auth from '../auth'; +import * as facebook from '../facebook'; const token = 'alsnjfjwqfpuqfeownposfnjnsaobjfaslkklnsfd'; const refreshToken = 'refresh'; diff --git a/__tests__/actions/auth.js b/src/actions/__tests__/auth.js similarity index 89% rename from __tests__/actions/auth.js rename to src/actions/__tests__/auth.js index 5b0f43b213..72f1f64625 100644 --- a/__tests__/actions/auth.js +++ b/src/actions/__tests__/auth.js @@ -4,17 +4,17 @@ import i18next from 'i18next'; import MockDate from 'mockdate'; import { Linking } from 'react-native'; -import * as callApi from '../../src/actions/api'; -import * as constants from '../../src/constants'; -import { REQUESTS } from '../../src/actions/api'; -import * as navigation from '../../src/actions/navigation'; -import * as login from '../../src/actions/login'; -import * as auth from '../../src/actions/auth'; -import * as person from '../../src/actions/person'; -import * as organizations from '../../src/actions/organizations'; -import * as stages from '../../src/actions/stages'; -import * as steps from '../../src/actions/steps'; -import * as notifications from '../../src/actions/notifications'; +import * as callApi from '../api'; +import { REQUESTS } from '../api'; +import * as constants from '../../constants'; +import * as navigation from '../navigation'; +import * as login from '../login'; +import * as auth from '../auth'; +import * as person from '../person'; +import * as organizations from '../organizations'; +import * as stages from '../stages'; +import * as steps from '../steps'; +import * as notifications from '../notifications'; import { keyLogin, refreshAccessToken, @@ -23,16 +23,16 @@ import { logout, upgradeAccount, openKeyURL, -} from '../../src/actions/auth'; -import { mockFnWithParams } from '../../testUtils'; -import { LOGIN_OPTIONS_SCREEN } from '../../src/containers/LoginOptionsScreen'; -import { OPEN_URL } from '../../src/constants'; -import { getTimezoneString } from '../../src/actions/auth'; -import { refreshAnonymousLogin } from '../../src/actions/auth'; -import { deletePushToken } from '../../src/actions/notifications'; -import * as onboardingProfile from '../../src/actions/onboardingProfile'; - -jest.mock('../../src/actions/notifications'); +} from '../auth'; +import { mockFnWithParams } from '../../../testUtils'; +import { LOGIN_OPTIONS_SCREEN } from '../../containers/LoginOptionsScreen'; +import { OPEN_URL } from '../../constants'; +import { getTimezoneString } from '../auth'; +import { refreshAnonymousLogin } from '../auth'; +import { deletePushToken } from '../notifications'; +import * as onboardingProfile from '../onboardingProfile'; + +jest.mock('../../actions/notifications'); const email = 'klas&jflk@lkjasdf.com'; const password = 'this&is=unsafe'; diff --git a/__tests__/actions/celebration.js b/src/actions/__tests__/celebration.js similarity index 91% rename from __tests__/actions/celebration.js rename to src/actions/__tests__/celebration.js index f4663d4599..c8648e1eb7 100644 --- a/__tests__/actions/celebration.js +++ b/src/actions/__tests__/celebration.js @@ -1,17 +1,14 @@ import configureStore from 'redux-mock-store'; import thunk from 'redux-thunk'; -import { - getGroupCelebrateFeed, - toggleLike, -} from '../../src/actions/celebration'; -import callApi, { REQUESTS } from '../../src/actions/api'; +import { getGroupCelebrateFeed, toggleLike } from '../celebration'; +import callApi, { REQUESTS } from '../api'; import { DEFAULT_PAGE_LIMIT, RESET_CELEBRATION_PAGINATION, -} from '../../src/constants'; +} from '../../constants'; -jest.mock('../../src/actions/api'); +jest.mock('../api'); const orgId = '123'; diff --git a/__tests__/actions/challenges.js b/src/actions/__tests__/challenges.js similarity index 92% rename from __tests__/actions/challenges.js rename to src/actions/__tests__/challenges.js index dbd4e81977..de6182ae47 100644 --- a/__tests__/actions/challenges.js +++ b/src/actions/__tests__/challenges.js @@ -8,20 +8,20 @@ import { joinChallenge, createChallenge, updateChallenge, -} from '../../src/actions/challenges'; -import { reloadGroupCelebrateFeed } from '../../src/actions/celebration'; -import callApi, { REQUESTS } from '../../src/actions/api'; +} from '../challenges'; +import { reloadGroupCelebrateFeed } from '../celebration'; +import callApi, { REQUESTS } from '../api'; import { DEFAULT_PAGE_LIMIT, RESET_CHALLENGE_PAGINATION, -} from '../../src/constants'; -import { CELEBRATION_SCREEN } from '../../src/containers/CelebrationScreen'; -import * as common from '../../src/utils/common'; -import { navigatePush } from '../../src/actions/navigation'; +} from '../../constants'; +import { CELEBRATION_SCREEN } from '../../containers/CelebrationScreen'; +import * as common from '../../utils/common'; +import { navigatePush } from '../navigation'; -jest.mock('../../src/actions/api'); -jest.mock('../../src/actions/navigation'); -jest.mock('../../src/actions/celebration'); +jest.mock('../api'); +jest.mock('../navigation'); +jest.mock('../celebration'); const fakeDate = '2018-09-06T14:13:21Z'; common.formatApiDate = jest.fn(() => fakeDate); diff --git a/__tests__/actions/facebook.js b/src/actions/__tests__/facebook.js similarity index 92% rename from __tests__/actions/facebook.js rename to src/actions/__tests__/facebook.js index 4674137300..8d8c5740f7 100644 --- a/__tests__/actions/facebook.js +++ b/src/actions/__tests__/facebook.js @@ -2,16 +2,16 @@ import { AccessToken, LoginManager } from 'react-native-fbsdk'; import configureStore from 'redux-mock-store'; import thunk from 'redux-thunk'; -import { mockFnWithParams } from '../../testUtils'; -import { REQUESTS } from '../../src/actions/api'; -import * as callApi from '../../src/actions/api'; -import { ANALYTICS } from '../../src/constants'; -import * as analytics from '../../src/actions/analytics'; +import { mockFnWithParams } from '../../../testUtils'; +import { REQUESTS } from '../api'; +import * as callApi from '../api'; +import { ANALYTICS } from '../../constants'; +import * as analytics from '../analytics'; import { facebookLoginAction, facebookLoginWithUsernamePassword, refreshMissionHubFacebookAccess, -} from '../../src/actions/facebook'; +} from '../facebook'; const mockStore = configureStore([thunk]); diff --git a/__tests__/actions/impact.js b/src/actions/__tests__/impact.js similarity index 96% rename from __tests__/actions/impact.js rename to src/actions/__tests__/impact.js index 8e469d1b26..1f896e853c 100644 --- a/__tests__/actions/impact.js +++ b/src/actions/__tests__/impact.js @@ -5,10 +5,10 @@ import { getImpactSummary, getPeopleInteractionsReport, refreshImpact, -} from '../../src/actions/impact'; -import callApi, { REQUESTS } from '../../src/actions/api'; +} from '../impact'; +import callApi, { REQUESTS } from '../api'; -jest.mock('../../src/actions/api'); +jest.mock('../api'); const store = configureStore([thunk])(); diff --git a/__tests__/actions/interactions.js b/src/actions/__tests__/interactions.js similarity index 89% rename from __tests__/actions/interactions.js rename to src/actions/__tests__/interactions.js index 4c03004fdb..6b5e8f0989 100644 --- a/__tests__/actions/interactions.js +++ b/src/actions/__tests__/interactions.js @@ -1,20 +1,20 @@ import configureStore from 'redux-mock-store'; import thunk from 'redux-thunk'; -import { addNewInteraction, editComment } from '../../src/actions/interactions'; -import * as api from '../../src/actions/api'; -import { REQUESTS } from '../../src/actions/api'; -import * as analytics from '../../src/actions/analytics'; -import * as impact from '../../src/actions/impact'; -import { mockFnWithParams } from '../../testUtils'; -import { ACTIONS, INTERACTION_TYPES } from '../../src/constants'; -import { reloadGroupCelebrateFeed } from '../../src/actions/celebration'; -import { reloadJourney } from '../../src/actions/journey'; +import { addNewInteraction, editComment } from '../interactions'; +import * as api from '../api'; +import { REQUESTS } from '../api'; +import * as analytics from '../analytics'; +import * as impact from '../impact'; +import { mockFnWithParams } from '../../../testUtils'; +import { ACTIONS, INTERACTION_TYPES } from '../../constants'; +import { reloadGroupCelebrateFeed } from '../celebration'; +import { reloadJourney } from '../journey'; let store; -jest.mock('../../src/actions/celebration'); -jest.mock('../../src/actions/journey'); +jest.mock('../celebration'); +jest.mock('../journey'); const mockApi = (result, ...expectedParams) => mockFnWithParams(api, 'default', result, ...expectedParams); diff --git a/__tests__/actions/journey.js b/src/actions/__tests__/journey.js similarity index 95% rename from __tests__/actions/journey.js rename to src/actions/__tests__/journey.js index 6cb2e68d6b..b824af2c8c 100644 --- a/__tests__/actions/journey.js +++ b/src/actions/__tests__/journey.js @@ -1,16 +1,12 @@ import configureStore from 'redux-mock-store'; import thunk from 'redux-thunk'; -import callApi, { REQUESTS } from '../../src/actions/api'; -import { - getJourney, - reloadJourney, - getGroupJourney, -} from '../../src/actions/journey'; -import { isAdminForOrg } from '../../src/utils/common'; - -jest.mock('../../src/actions/api'); -jest.mock('../../src/utils/common'); +import callApi, { REQUESTS } from '../api'; +import { getJourney, reloadJourney, getGroupJourney } from '../journey'; +import { isAdminForOrg } from '../../utils/common'; + +jest.mock('../api'); +jest.mock('../../utils/common'); Date = jest.fn(() => ({ toISOString: () => '2018-04-17T00:00:00Z', diff --git a/__tests__/actions/login.js b/src/actions/__tests__/login.js similarity index 82% rename from __tests__/actions/login.js rename to src/actions/__tests__/login.js index 01accb327f..15329253a8 100644 --- a/__tests__/actions/login.js +++ b/src/actions/__tests__/login.js @@ -3,15 +3,15 @@ import thunk from 'redux-thunk'; import { Crashlytics } from 'react-native-fabric'; import * as RNOmniture from 'react-native-omniture'; -import * as person from '../../src/actions/person'; -import * as navigation from '../../src/actions/navigation'; -import { onSuccessfulLogin } from '../../src/actions/login'; -import { mockFnWithParams } from '../../testUtils'; -import * as analytics from '../../src/actions/analytics'; -import { ADD_SOMEONE_SCREEN } from '../../src/containers/AddSomeoneScreen'; -import { GET_STARTED_SCREEN } from '../../src/containers/GetStartedScreen'; -import { MAIN_TABS, ACTIONS } from '../../src/constants'; -import * as onboardingProfile from '../../src/actions/onboardingProfile'; +import * as person from '../person'; +import * as navigation from '../navigation'; +import { onSuccessfulLogin } from '../login'; +import { mockFnWithParams } from '../../../testUtils'; +import * as analytics from '../analytics'; +import { ADD_SOMEONE_SCREEN } from '../../containers/AddSomeoneScreen'; +import { GET_STARTED_SCREEN } from '../../containers/GetStartedScreen'; +import { MAIN_TABS, ACTIONS } from '../../constants'; +import * as onboardingProfile from '../onboardingProfile'; const mockStore = configureStore([thunk]); const personId = '593348'; diff --git a/__tests__/actions/misc.js b/src/actions/__tests__/misc.js similarity index 87% rename from __tests__/actions/misc.js rename to src/actions/__tests__/misc.js index 84314f1884..b8e0e7caf5 100644 --- a/__tests__/actions/misc.js +++ b/src/actions/__tests__/misc.js @@ -2,37 +2,37 @@ import ReactNative from 'react-native'; import thunk from 'redux-thunk'; import configureStore from 'redux-mock-store'; -import { trackActionWithoutData } from '../../src/actions/analytics'; +import { trackActionWithoutData } from '../analytics'; import { openCommunicationLink, loadStepsAndJourney, navigateToStageScreen, assignContactAndPickStage, -} from '../../src/actions/misc'; +} from '../misc'; import { createContactAssignment, updatePersonAttributes, getPersonScreenRoute, -} from '../../src/actions/person'; -import { getContactSteps } from '../../src/actions/steps'; -import { reloadJourney } from '../../src/actions/journey'; -import { navigatePush, navigateReplace } from '../../src/actions/navigation'; -import { PERSON_STAGE_SCREEN } from '../../src/containers/PersonStageScreen'; -import { STAGE_SCREEN } from '../../src/containers/StageScreen'; -import { CONTACT_PERSON_SCREEN } from '../../src/containers/Groups/AssignedPersonScreen'; +} from '../person'; +import { getContactSteps } from '../steps'; +import { reloadJourney } from '../journey'; +import { navigatePush, navigateReplace } from '../navigation'; +import { PERSON_STAGE_SCREEN } from '../../containers/PersonStageScreen'; +import { STAGE_SCREEN } from '../../containers/StageScreen'; +import { CONTACT_PERSON_SCREEN } from '../../containers/Groups/AssignedPersonScreen'; import { contactAssignmentSelector, orgPermissionSelector, -} from '../../src/selectors/people'; -import { isMemberForOrg } from '../../src/utils/common'; - -jest.mock('../../src/actions/analytics'); -jest.mock('../../src/actions/steps'); -jest.mock('../../src/actions/journey'); -jest.mock('../../src/actions/navigation'); -jest.mock('../../src/actions/person'); -jest.mock('../../src/selectors/people'); -jest.mock('../../src/utils/common'); +} from '../../selectors/people'; +import { isMemberForOrg } from '../../utils/common'; + +jest.mock('../analytics'); +jest.mock('../steps'); +jest.mock('../journey'); +jest.mock('../navigation'); +jest.mock('../person'); +jest.mock('../../selectors/people'); +jest.mock('../../utils/common'); const mockStore = state => configureStore([thunk])(state); let store; diff --git a/__tests__/actions/navigation.js b/src/actions/__tests__/navigation.js similarity index 98% rename from __tests__/actions/navigation.js rename to src/actions/__tests__/navigation.js index 408375706d..4e5709fd9a 100644 --- a/__tests__/actions/navigation.js +++ b/src/actions/__tests__/navigation.js @@ -16,7 +16,7 @@ import { navigateBack, navigateReset, navigateReplace, -} from '../../src/actions/navigation'; +} from '../navigation'; const routeName = 'screenName'; const params = { prop1: 'value1' }; diff --git a/__tests__/actions/navigationInit.js b/src/actions/__tests__/navigationInit.js similarity index 93% rename from __tests__/actions/navigationInit.js rename to src/actions/__tests__/navigationInit.js index 23c0b24dad..6f8dd90374 100644 --- a/__tests__/actions/navigationInit.js +++ b/src/actions/__tests__/navigationInit.js @@ -1,8 +1,8 @@ -import { MAIN_TABS } from '../../src/constants'; -import { ADD_SOMEONE_SCREEN } from '../../src/containers/AddSomeoneScreen'; -import { GET_STARTED_SCREEN } from '../../src/containers/GetStartedScreen'; -import { initialRoute } from '../../src/actions/navigationInit'; -import { LOGIN_SCREEN } from '../../src/containers/LoginScreen'; +import { MAIN_TABS } from '../../constants'; +import { ADD_SOMEONE_SCREEN } from '../../containers/AddSomeoneScreen'; +import { GET_STARTED_SCREEN } from '../../containers/GetStartedScreen'; +import { initialRoute } from '../navigationInit'; +import { LOGIN_SCREEN } from '../../containers/LoginScreen'; const token = 'sfhaspofuasdnfpwqnfoiqwofiwqioefpqwnofuoweqfniuqweouiowqefonpqnowfpowqfneqowfenopnqwnfeo'; diff --git a/__tests__/actions/notifications.js b/src/actions/__tests__/notifications.js similarity index 96% rename from __tests__/actions/notifications.js rename to src/actions/__tests__/notifications.js index 4911de6545..2edd428096 100644 --- a/__tests__/actions/notifications.js +++ b/src/actions/__tests__/notifications.js @@ -12,7 +12,7 @@ import { configureNotificationHandler, requestNativePermissions, showReminderOnLoad, -} from '../../src/actions/notifications'; +} from '../notifications'; import { GCM_SENDER_ID, LOAD_PERSON_DETAILS, @@ -20,14 +20,14 @@ import { NAVIGATE_FORWARD, LOAD_HOME_NOTIFICATION_REMINDER, REQUEST_NOTIFICATIONS, -} from '../../src/constants'; -import * as common from '../../src/utils/common'; -import callApi, { REQUESTS } from '../../src/actions/api'; -import { getPersonDetails, navToPersonScreen } from '../../src/actions/person'; -import { NOTIFICATION_PRIMER_SCREEN } from '../../src/containers/NotificationPrimerScreen'; - -jest.mock('../../src/actions/person'); -jest.mock('../../src/actions/api'); +} from '../../constants'; +import * as common from '../../utils/common'; +import callApi, { REQUESTS } from '../api'; +import { getPersonDetails, navToPersonScreen } from '../person'; +import { NOTIFICATION_PRIMER_SCREEN } from '../../containers/NotificationPrimerScreen'; + +jest.mock('../person'); +jest.mock('../api'); jest.mock('react-native-push-notification'); jest.mock('react-native-config', () => ({ GCM_SENDER_ID: 'Test GCM Sender ID', diff --git a/__tests__/actions/onboardingProfile.js b/src/actions/__tests__/onboardingProfile.js similarity index 94% rename from __tests__/actions/onboardingProfile.js rename to src/actions/__tests__/onboardingProfile.js index 6f0bee2791..5e5b14df83 100644 --- a/__tests__/actions/onboardingProfile.js +++ b/src/actions/__tests__/onboardingProfile.js @@ -9,7 +9,7 @@ import { createPerson, resetPerson, completeOnboarding, -} from '../../src/actions/onboardingProfile'; +} from '../onboardingProfile'; import { COMPLETE_ONBOARDING, FIRST_NAME_CHANGED, @@ -17,10 +17,10 @@ import { PERSON_FIRST_NAME_CHANGED, PERSON_LAST_NAME_CHANGED, RESET_ONBOARDING_PERSON, -} from '../../src/constants'; -import callApi, { REQUESTS } from '../../src/actions/api'; +} from '../../constants'; +import callApi, { REQUESTS } from '../api'; -jest.mock('../../src/actions/api'); +jest.mock('../api'); const dispatch = jest.fn(response => Promise.resolve(response)); diff --git a/__tests__/actions/organizations.js b/src/actions/__tests__/organizations.js similarity index 98% rename from __tests__/actions/organizations.js rename to src/actions/__tests__/organizations.js index 1ab1e8db98..dbad0375d8 100644 --- a/__tests__/actions/organizations.js +++ b/src/actions/__tests__/organizations.js @@ -8,8 +8,8 @@ import { GET_ORGANIZATION_PEOPLE, LOAD_ORGANIZATIONS, DEFAULT_PAGE_LIMIT, -} from '../../src/constants'; -import callApi, { REQUESTS } from '../../src/actions/api'; +} from '../../constants'; +import callApi, { REQUESTS } from '../api'; import { getMyOrganizations, getOrganizationsContactReports, @@ -18,10 +18,10 @@ import { getOrganizationMembersNextPage, addNewPerson, getMyCommunities, -} from '../../src/actions/organizations'; +} from '../organizations'; -jest.mock('../../src/selectors/organizations'); -jest.mock('../../src/actions/api'); +jest.mock('../../selectors/organizations'); +jest.mock('../api'); const myId = '1'; diff --git a/__tests__/actions/people.js b/src/actions/__tests__/people.js similarity index 96% rename from __tests__/actions/people.js rename to src/actions/__tests__/people.js index 09f17eb422..dfd86bd1d9 100644 --- a/__tests__/actions/people.js +++ b/src/actions/__tests__/people.js @@ -1,10 +1,10 @@ import configureStore from 'redux-mock-store'; import thunk from 'redux-thunk'; -import { searchPeople, getMyPeople } from '../../src/actions/people'; -import callApi, { REQUESTS } from '../../src/actions/api'; +import { searchPeople, getMyPeople } from '../people'; +import callApi, { REQUESTS } from '../api'; -jest.mock('../../src/actions/api'); +jest.mock('../api'); const mockStore = configureStore([thunk]); let store; diff --git a/__tests__/actions/person.js b/src/actions/__tests__/person.js similarity index 96% rename from __tests__/actions/person.js rename to src/actions/__tests__/person.js index 27339e9931..f0ffa7600f 100644 --- a/__tests__/actions/person.js +++ b/src/actions/__tests__/person.js @@ -6,7 +6,7 @@ import { LOAD_PERSON_DETAILS, DELETE_PERSON, ORG_PERMISSIONS, -} from '../../src/constants'; +} from '../../constants'; import { getMe, getPersonDetails, @@ -18,10 +18,10 @@ import { savePersonNote, getPersonNote, navToPersonScreen, -} from '../../src/actions/person'; -import callApi, { REQUESTS } from '../../src/actions/api'; -import * as analytics from '../../src/actions/analytics'; -import { navigatePush } from '../../src/actions/navigation'; +} from '../person'; +import callApi, { REQUESTS } from '../api'; +import * as analytics from '../analytics'; +import { navigatePush } from '../navigation'; import { CONTACT_PERSON_SCREEN, IS_USER_CREATED_MEMBER_PERSON_SCREEN, @@ -30,19 +30,19 @@ import { ME_PERSONAL_PERSON_SCREEN, IS_GROUPS_ME_COMMUNITY_PERSON_SCREEN, ME_COMMUNITY_PERSON_SCREEN, -} from '../../src/containers/Groups/AssignedPersonScreen/'; -import { UNASSIGNED_PERSON_SCREEN } from '../../src/containers/Groups/UnassignedPersonScreen'; +} from '../../containers/Groups/AssignedPersonScreen'; +import { UNASSIGNED_PERSON_SCREEN } from '../../containers/Groups/UnassignedPersonScreen'; import { personSelector, orgPermissionSelector, contactAssignmentSelector, -} from '../../src/selectors/people'; -import { organizationSelector } from '../../src/selectors/organizations'; +} from '../../selectors/people'; +import { organizationSelector } from '../../selectors/organizations'; -jest.mock('../../src/actions/api'); -jest.mock('../../src/actions/navigation'); -jest.mock('../../src/selectors/people'); -jest.mock('../../src/selectors/organizations'); +jest.mock('../api'); +jest.mock('../navigation'); +jest.mock('../../selectors/people'); +jest.mock('../../selectors/organizations'); const myId = '1'; diff --git a/__tests__/actions/selectStage.js b/src/actions/__tests__/selectStage.js similarity index 84% rename from __tests__/actions/selectStage.js rename to src/actions/__tests__/selectStage.js index d15fc07fd9..c68070238e 100644 --- a/__tests__/actions/selectStage.js +++ b/src/actions/__tests__/selectStage.js @@ -1,17 +1,14 @@ import configureStore from 'redux-mock-store'; import thunk from 'redux-thunk'; -import { - updateUserStage, - selectPersonStage, -} from '../../src/actions/selectStage'; -import callApi, { REQUESTS } from '../../src/actions/api'; -import { refreshImpact } from '../../src/actions/impact'; -import { getPersonDetails } from '../../src/actions/person'; +import { updateUserStage, selectPersonStage } from '../selectStage'; +import callApi, { REQUESTS } from '../api'; +import { refreshImpact } from '../impact'; +import { getPersonDetails } from '../person'; -jest.mock('../../src/actions/api'); -jest.mock('../../src/actions/impact'); -jest.mock('../../src/actions/person'); +jest.mock('../api'); +jest.mock('../impact'); +jest.mock('../person'); const mockStore = configureStore([thunk]); let store; diff --git a/__tests__/actions/steps.js b/src/actions/__tests__/steps.js similarity index 94% rename from __tests__/actions/steps.js rename to src/actions/__tests__/steps.js index eac1836492..80089cab6e 100644 --- a/__tests__/actions/steps.js +++ b/src/actions/__tests__/steps.js @@ -2,7 +2,7 @@ import configureStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import i18next from 'i18next'; -import callApi, { REQUESTS } from '../../src/actions/api'; +import callApi, { REQUESTS } from '../api'; import { completeStep, getStepSuggestions, @@ -12,13 +12,13 @@ import { addSteps, completeStepReminder, deleteStepWithTracking, -} from '../../src/actions/steps'; -import { reloadGroupCelebrateFeed } from '../../src/actions/celebration'; -import { refreshImpact } from '../../src/actions/impact'; -import * as analytics from '../../src/actions/analytics'; -import { mockFnWithParams } from '../../testUtils'; -import * as common from '../../src/utils/common'; -import { buildTrackingObj } from '../../src/utils/common'; +} from '../steps'; +import { reloadGroupCelebrateFeed } from '../celebration'; +import { refreshImpact } from '../impact'; +import * as analytics from '../analytics'; +import { mockFnWithParams } from '../../../testUtils'; +import * as common from '../../utils/common'; +import { buildTrackingObj } from '../../utils/common'; import { ACTIONS, COMPLETED_STEP_COUNT, @@ -26,8 +26,8 @@ import { STEP_NOTE, TOGGLE_STEP_FOCUS, CUSTOM_STEP_TYPE, -} from '../../src/constants'; -import { ADD_STEP_SCREEN } from '../../src/containers/AddStepScreen'; +} from '../../constants'; +import { ADD_STEP_SCREEN } from '../../containers/AddStepScreen'; const mockStore = configureStore([thunk]); let store; @@ -38,9 +38,9 @@ const orgId = '123'; const mockDate = '2018-02-14 11:30:00 UTC'; common.formatApiDate = jest.fn().mockReturnValue(mockDate); -jest.mock('../../src/actions/api'); -jest.mock('../../src/actions/impact'); -jest.mock('../../src/actions/celebration'); +jest.mock('../api'); +jest.mock('../impact'); +jest.mock('../celebration'); beforeEach(() => { jest.clearAllMocks(); diff --git a/__tests__/actions/surveys.js b/src/actions/__tests__/surveys.js similarity index 91% rename from __tests__/actions/surveys.js rename to src/actions/__tests__/surveys.js index 89f1a468d3..4039d7b188 100644 --- a/__tests__/actions/surveys.js +++ b/src/actions/__tests__/surveys.js @@ -1,17 +1,13 @@ import configureStore from 'redux-mock-store'; import thunk from 'redux-thunk'; -import callApi, { REQUESTS } from '../../src/actions/api'; -import { - getMySurveys, - getOrgSurveys, - getOrgSurveysNextPage, -} from '../../src/actions/surveys'; -import { GET_ORGANIZATION_SURVEYS } from '../../src/constants'; +import callApi, { REQUESTS } from '../api'; +import { getMySurveys, getOrgSurveys, getOrgSurveysNextPage } from '../surveys'; +import { GET_ORGANIZATION_SURVEYS } from '../../constants'; const apiResponse = { type: 'successful' }; -jest.mock('../../src/actions/api'); +jest.mock('../api'); let store; diff --git a/__tests__/api/api.js b/src/api/__tests__/api.js similarity index 90% rename from __tests__/api/api.js rename to src/api/__tests__/api.js index dba46e5bf1..1f92877215 100644 --- a/__tests__/api/api.js +++ b/src/api/__tests__/api.js @@ -1,6 +1,7 @@ -import API_CALLS from '../../src/api/index'; -import * as utils from '../../src/api/utils'; -import { REQUESTS } from '../../src/actions/api'; +import API_CALLS from '..'; + +import * as utils from '../utils'; +import { REQUESTS } from '../../actions/api'; beforeEach(() => { global.APILOG = jest.fn(); diff --git a/__tests__/api/utils.js b/src/api/__tests__/utils.js similarity index 99% rename from __tests__/api/utils.js rename to src/api/__tests__/utils.js index 7b2e3c91a3..d1e72717cb 100644 --- a/__tests__/api/utils.js +++ b/src/api/__tests__/utils.js @@ -1,4 +1,4 @@ -import request from '../../src/api/utils'; +import request from '../utils'; const sessionKey = 'X-MH-Session'; diff --git a/__tests__/components/AssignToMeButton.js b/src/components/AssignToMeButton/__tests__/AssignToMeButton.js similarity index 80% rename from __tests__/components/AssignToMeButton.js rename to src/components/AssignToMeButton/__tests__/AssignToMeButton.js index 797ae5f372..db0423d067 100644 --- a/__tests__/components/AssignToMeButton.js +++ b/src/components/AssignToMeButton/__tests__/AssignToMeButton.js @@ -2,14 +2,16 @@ import React from 'react'; import thunk from 'redux-thunk'; import configureStore from 'redux-mock-store'; -import { testSnapshotShallow, renderShallow } from '../../testUtils'; -import AssignToMeButton from '../../src/components/AssignToMeButton'; -import { assignContactAndPickStage } from '../../src/actions/misc'; - -jest.mock('../../src/actions/misc'); -jest.mock('../../src/actions/person'); -jest.mock('../../src/selectors/people'); -jest.mock('../../src/actions/navigation'); +import { testSnapshotShallow, renderShallow } from '../../../../testUtils'; + +import AssignToMeButton from '..'; + +import { assignContactAndPickStage } from '../../../actions/misc'; + +jest.mock('../../../actions/misc'); +jest.mock('../../../actions/person'); +jest.mock('../../../selectors/people'); +jest.mock('../../../actions/navigation'); const myId = '25'; const state = { auth: { person: { id: myId } } }; diff --git a/__tests__/components/__snapshots__/AssignToMeButton.js.snap b/src/components/AssignToMeButton/__tests__/__snapshots__/AssignToMeButton.js.snap similarity index 100% rename from __tests__/components/__snapshots__/AssignToMeButton.js.snap rename to src/components/AssignToMeButton/__tests__/__snapshots__/AssignToMeButton.js.snap diff --git a/__tests__/Button.js b/src/components/Button/__tests__/Button.js similarity index 88% rename from __tests__/Button.js rename to src/components/Button/__tests__/Button.js index e19fb529a5..c933e27ae0 100644 --- a/__tests__/Button.js +++ b/src/components/Button/__tests__/Button.js @@ -2,9 +2,9 @@ import 'react-native'; import React from 'react'; import { shallow } from 'enzyme'; -// Note: test renderer must be required after react-native. -import { Button } from '../src/components/common'; -import { testSnapshot } from '../testUtils'; +import Button from '..'; + +import { testSnapshot } from '../../../../testUtils'; it('renders correctly', () => { testSnapshot(