-
-
Notifications
You must be signed in to change notification settings - Fork 860
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
Jest Testing #25
Comments
Yeah for sure! Thanks so much @jakelacey2012 |
Hi @mcnamee thanks for getting back to me Whats the problem... When running test we get this (ノಥ,_」ಥ)ノ彡┻━┻ Jakes-MacBook-Pro[react-native-starter-app] (feature/reactJestTesting)$npm test -- -u
> StarterKit@1.0.0 test /Users/jakelacey/Documents/workspace/reactnative/react-native-starter-app
> jest "-u"
PASS ReactApp/components/__tests__/navbar.elements-tests.js
PASS ReactApp/components/__tests__/error-tests.js
PASS ReactApp/components/__tests__/alerts-tests.js
PASS ReactApp/components/__tests__/button-tests.js
PASS ReactApp/components/__tests__/loading-tests.js
PASS ReactApp/components/__tests__/list.row-tests.js
FAIL ReactApp/components/__tests__/menu-tests.js
● Test suite failed to run
SyntaxError: Unexpected reserved word
at transformAndBuildScript (node_modules/jest-runtime/build/transform.js:284:10)
at Object.<anonymous> (ReactApp/screens/forms.js:22:22)
at Object.<anonymous> (ReactApp/screens/first.load.js:27:12)
[core]
Test Suites: 1 failed, 6 passed, 7 total
Tests: 7 passed, 7 total
Snapshots: 7 passed, 7 total
Time: 4.166s
Ran all test suites.
npm ERR! Test failed. See above for more details. It looks like this module I haven't identified the reserved words used, I'm gonna keep looking.... but If you have any thoughts it would be helpful! :) |
So good, thanks man! Can't wait to see more of your work :) |
I've created an issue on |
Woo managed to find some time to get it working!! I've created a PR here #29, I had a merge conflict in package.json so let me know if something is broken |
Thank you for accepting my PR, Keep this issue open just in case something pops up. |
Hey @jakelacey2012 - are you interested in writing some more thorough tests? |
For sure :) My next objective will be writing documentation for this so anyone can do it. |
Hey @jakelacey2012 The basics of v2 - is that it'll contain more of a boilerplate to interact with an API (showing how to pull data from a RESTful API and then put data into Redux). |
No worries :) FAIL src/components/__tests__/menu-tests.js
● Test suite failed to run
TypeError: Cannot read property 'appVersion' of undefined
at Object.getVersion (node_modules/react-native-device-info/deviceinfo.js:39:20)
at Object.<anonymous> (src/utils/api.js:26:33)
at Object.<anonymous> (src/reducers/user/actions.js:50:112)
at Object.<anonymous> (src/containers/login.js:10:14)
FAIL src/components/__tests__/firstload-test.js
● Test suite failed to run
TypeError: Cannot read property 'appVersion' of undefined
at Object.getVersion (node_modules/react-native-device-info/deviceinfo.js:39:20)
at Object.<anonymous> (src/utils/api.js:26:33)
at Object.<anonymous> (src/reducers/recipes/actions.js:10:28)
at Object.<anonymous> (src/containers/recipes.js:10:14) The two tests are failing because of this npm package Effectively @mcnamee Do you know if there is anything we can do to the at the moment I've got a solution but... it's abit hacky :( let ua;
try {
// Build user agent string
ua = `${AppConfig.appName} ` +
`${DeviceInfo.getVersion()}; ${DeviceInfo.getSystemName()} ` +
`${DeviceInfo.getSystemVersion()}; ${DeviceInfo.getBrand()} ` +
`${DeviceInfo.getDeviceId()}`;
} catch(e) {
ua = `${AppConfig.appName}`;
}
const USER_AGENT = ua; If this package doesn't allow us to choose an environment... then what we can do is build a very basic wrapper library that does this job for us. let me know what you think. |
Hey @jakelacey2012 |
Hi nice project by the way,
I've just started using it and its really awesome! I've added jest testing to my project and I'm just wondering would you like me to make a pull request which implements jest testing within this project?
The text was updated successfully, but these errors were encountered: