Skip to content

Commit

Permalink
YOMA-485 - feat(User): fetch credential data (#90)
Browse files Browse the repository at this point in the history
* feat(User): adding get user credentials middleware and actions, fixing some package requirements

* chore: adding help.json description for reset command

* refactor(User): adding middleware for fetching user credentials

* refactor(User,App, Auth): adding middleware and actions to ensure the credential data is fetched on user auth

* chore: removing unused import

* feat(App, Auth): adding tests for new middleware and test mocks

* tests: huge fights getting this to work... but working now. Had to refactor the way we're passing the FB/Google svg as the test suite was moaning.

* tests: moving mocks to jest setup file

* tests: renaming jestSetup and adding to jest.ui file

* tests: renaming jestSetup and adding to jest.ui file

* refactor(App, Auth): adding tests, renaming action/middleware to hydrateApp(Flow)

* refactor(User): working on Api call to get successful response

* chore(User): fixing middleware/test linting issues

* refactor(api): adding console log of errors for Dev only, adding a type for the credential type options, updating selector tests to use rootStateFixture

* tests: adding tests for selectUserId, and fixing rootStateFixture util

* tests: fixing createFixture util to fallback to {} if override not set, moving UserResponse type to the User module, as well as the USER_RESPONSE mock to the user test fixtures

* chore: updating scripts for linting, removing unused imports

* tests: refactoring User selector tests - so that it's ordered in the same order as teh selector file

* chore: updating package-lock

* refactor(User): rolling back unnecesary changes, renamed selectUserId to selectId
  • Loading branch information
cameronolivier authored Jul 12, 2021
1 parent 24eae71 commit 991e236
Show file tree
Hide file tree
Showing 44 changed files with 446 additions and 24,378 deletions.
2 changes: 1 addition & 1 deletion __mocks__/@react-native-google-signin/google-signin.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const googleSignIn = jest.mock('@react-native-google-signin/google-signin', () => ({}))
const googleSignIn = jest.mock('@react-native-google-signin/google-signin', () => ({ GoogleSignIn: jest.fn() }))

module.exports = googleSignIn
2 changes: 2 additions & 0 deletions __mocks__/react-native-fbsdk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const LoginMananger = { logInWithPermissions: jest.fn() }
export { LoginMananger }
1 change: 1 addition & 0 deletions __mocks__/react-native-flash-message.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default jest.fn()
10 changes: 0 additions & 10 deletions __mocks__/react-native-localize.js

This file was deleted.

3 changes: 2 additions & 1 deletion help.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"lint": "run JS linter",
"format": "formats the codebase with prettier",
"code:lint": "runs prettier and eslint linters",
"npm:audit": "audit NPM dependencies for critical vulnerabilities"
"npm:audit": "audit NPM dependencies for critical vulnerabilities",
"reset": "deletes node modules and re-installs modules and pods"
}
48 changes: 24 additions & 24 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -731,13 +731,13 @@ SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de
EXConstants: c4dd28acc12039c999612507a5f935556f2c86ce
EXFileSystem: dcf2273f49431e5037347c733a2dc5d08e0d0a9e
EXImageLoader: da941c9399e01ec28f2d5b270bdd21f2c8ca596c
EXPermissions: 8f8c1c05580c4e02d4ee2c8dd74bfe173ff6a723
EXSecureStore: da5a255445bb6ee8b8ac54f65412bc803272bd87
EXConstants: c00cd53a17a65b2e53ddb3890e4e74d3418e406e
EXFileSystem: 35769beb727d5341d1276fd222710f9704f7164e
EXImageLoader: 1ad8b491fd0f3200b57b37ecb1801abeb6549926
EXPermissions: ea8d63dd052737765bd350b2ca7cee9bcfd5e18e
EXSecureStore: bc0d9a2796109886ba55e25e0e7db5587c584a61
FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b
FBReactNativeSpec: a256b4ea50adbb5b2eb139313062b9dfed2a20bc
FBReactNativeSpec: 5fd48a94dfe23ded2023a31ee2e8f72c0cc7d855
FBSDKCoreKit: 4afd6ff53d8133a433dbcda44451c9498f8c6ce4
FBSDKLoginKit: 7181765f2524d7ebf82d9629066c8e6caafc99d0
FBSDKShareKit: 0c0d51b3af47075a85ed9bea0e28b2fc70e3594b
Expand Down Expand Up @@ -774,7 +774,7 @@ SPEC CHECKSUMS:
React-jsinspector: cc614ec18a9ca96fd275100c16d74d62ee11f0ae
react-native-fbsdk: 8e92c7a334fd8d9c2b5d8b8fcd7ae2c314161099
react-native-flipper: 558237babdf0ee5d5360ebac860d3a5d1d9fc133
react-native-safe-area-context: f0906bf8bc9835ac9a9d3f97e8bde2a997d8da79
react-native-safe-area-context: e471852c5ed67eea4b10c5d9d43c1cebae3b231d
React-perflogger: 25373e382fed75ce768a443822f07098a15ab737
React-RCTActionSheet: af7796ba49ffe4ca92e7277a5d992d37203f7da5
React-RCTAnimation: 6a2e76ab50c6f25b428d81b76a5a45351c4d77aa
Expand All @@ -787,32 +787,32 @@ SPEC CHECKSUMS:
React-RCTVibration: 24600e3b1aaa77126989bc58b6747509a1ba14f3
React-runtimeexecutor: a9904c6d0218fb9f8b19d6dd88607225927668f9
ReactCommon: 149906e01aa51142707a10665185db879898e966
RNCAsyncStorage: 56a3355a10b5d660c48c6e37325ac85ebfd09885
RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489
RNDateTimePicker: 7658208086d86d09e1627b5c34ba0cf237c60140
RNCAsyncStorage: 8324611026e8dc3706f829953aa6e3899f581589
RNCMaskedView: f127cd9652acfa31b91dcff613e07ba18b774db6
RNDateTimePicker: c9911be59b1f8670b9f244b85af3a7c295e175ed
RNFBApp: 406bc9586c70ccf20504b4d3b54ac4341c98993f
RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211
RNGoogleSignin: e64616a4080cf7d83f4b292fad82d174587444e2
RNImageCropPicker: 35a3ceb837446fa11547704709bb22b5fac6d584
RNLocalize: 82a569022724d35461e2dc5b5d015a13c3ca995b
RNLocalize: b9a5d22c7e4ecb5db604861f1b1fff6013e03340
RNReanimated: 9c13c86454bfd54dab7505c1a054470bfecd2563
RNScreens: f7ad633b2e0190b77b6a7aab7f914fad6f198d8d
RNSVG: 551acb6562324b1d52a4e0758f7ca0ec234e278f
RNVectorIcons: 31cebfcf94e8cf8686eb5303ae0357da64d7a5a4
TOCropViewController: 3105367e808b7d3d886a74ff59bf4804e7d3ab38
UMAppLoader: fe2708bb0ac5cd70052bc207d06aa3b7e72b9e97
UMBarCodeScannerInterface: 79f92bea5f7af39b381a4c82298105ceb537408a
UMCameraInterface: 81ff46700da88435f17afedfc88915eaede7e6a6
UMConstantsInterface: bb94dd46039dcde276ed50225b29e22785e604bf
UMCore: 60b35f4d217461f7b54934b0c5be67442871f01f
UMFaceDetectorInterface: 791eec55ffca1171992976b7eceb73e69e391c58
UMFileSystemInterface: f72245e90ce78fa6427180ff0b0904ead13d8161
UMFontInterface: 5843cff7db85a42ba629aaac53d33091c35524d3
UMImageLoaderInterface: 9ddffeb644b3f45d4eb0c2f51a2fd95fd5c8d1a4
UMPermissionsInterface: 40b72935a7d12a3f60dc6b7bb99ce47908380cb1
UMReactNativeAdapter: 65ada852a648fcb6674acfbfe72ccb095f2f5b75
UMSensorsInterface: a5e9db661e5d9ae214762033d725989880ae6993
UMTaskManagerInterface: 203c11259d2699b5b3a4eda4adbc466f5cb5c561
UMAppLoader: aae896b81e3fcaa6528992e2e19ec8db38c2cedd
UMBarCodeScannerInterface: 96a01d81ff0c7febbfefc2d7396db9e7462d8c68
UMCameraInterface: 8ad433fdadca22703ebeb614d42b814092d38d69
UMConstantsInterface: 55c79ca258a3ede70480fed85e3843899cd47ea3
UMCore: 0da048c9753abcea0042258e6ad0fed77811f7e1
UMFaceDetectorInterface: 4db950a25e785796a237bcebb8fff05078c4fb61
UMFileSystemInterface: 4a92ee36e6c2757833031718f8496690fa931280
UMFontInterface: 81a951117d03f57aa636fba3992adefd0191f200
UMImageLoaderInterface: 5cd09b41630dc8aef7619fabc497c01c0f6b715c
UMPermissionsInterface: 4351145563e703c521fe2299e08227bc3584b94a
UMReactNativeAdapter: 7b458ca3d4497b5114e6bb766b223432bad22d8a
UMSensorsInterface: 50439b47826e716a514cbd7384aebe9ab4fde5f4
UMTaskManagerInterface: 482155764886069beb1bc7fcf6036f12e4ad0751
Yoga: 575c581c63e0d35c9a83f4b46d01d63abc1100ac
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

Expand Down
5 changes: 3 additions & 2 deletions jest.node.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ const config = {
'^.+\\.ts?$': 'babel-jest',
},
transformIgnorePatterns: [
'node_modules/(?!(@react-native|react-native)/.*)(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|@sentry/.*)',
'node_modules/(?!(@react-native|react-native)/.*)(?!(@react-native-google-signin)/.*)(?!(@react-navigation|react-navigation)/.*)(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|@sentry/.*)',
],
roots: ['<rootDir>/src'],
testRegex: '(.+)[^ui]\\.test\\.ts[x]{0,1}$',
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
setupFiles: [
'./node_modules/react-native-gesture-handler/jestSetup.js',
'<rootDir>/tests/jest.setup.js',
'<rootDir>/node_modules/react-native-gesture-handler/jestSetup.js',
],
}

Expand Down
4 changes: 2 additions & 2 deletions jest.ui.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ const config = {
},
roots: ['<rootDir>/src'],
testMatch: ['**/*.ui.test.ts?(x)'],
setupFiles: ['./node_modules/react-native-gesture-handler/jestSetup.js'],
setupFiles: ['<rootDir>/tests/jest.setup.js', '<rootDir>/node_modules/react-native-gesture-handler/jestSetup.js'],
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'],
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
transformIgnorePatterns: [
'node_modules/(?!(@react-native|react-native)/.*)(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|@sentry/.*)',
'node_modules/(?!(@react-native|react-native)/.*)(?!(@react-navigation|react-navigation)/.*)(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|@sentry/.*)',
],
}

Expand Down
2 changes: 1 addition & 1 deletion metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = (async () => {
return {
transformer: {
babelTransformerPath: require.resolve("react-native-svg-transformer"),
experimentalImportSupport: false,
experimentalImportSupport: true,
inlineRequires: true,
},
maxWorkers: 2,
Expand Down
Loading

0 comments on commit 991e236

Please sign in to comment.