Comments (12)
Yeah for sure! Thanks so much @jakelacey2012
from react-native-starter-kit.
So good, thanks man!
I'd suggest looking into the reserved words they're using, and raising an issue with them if it's a concern.
Can't wait to see more of your work :)
from react-native-starter-kit.
I've created an issue on tcomb-form-native
gcanti/tcomb-form-native#264 just so I can keep the ball rolling and not let this go stale.
from react-native-starter-kit.
Hey @jakelacey2012 - are you interested in writing some more thorough tests?
I've got a new branch - v2 - which could do with your testing expertise :)
from react-native-starter-kit.
Hi @mcnamee thanks for getting back to me
So i've started to create some simple snapshot tests hit a wall hopefuly you can help with https://github.com/jakelacey2012/react-native-starter-app/tree/feature/reactJestTesting is the fork you can run the tests by running npm test
.
Whats the problem... When running test we get this
(ノಥ,_」ಥ)ノ彡┻━┻ Jakes-MacBook-Pro[react-native-starter-app] (feature/reactJestTesting)$npm test -- -u
> [email protected] 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 import FormValidation from 'tcomb-form-native'
in form.js is causing some problems by using reserved words.
I haven't identified the reserved words used, I'm gonna keep looking.... but If you have any thoughts it would be helpful! :)
from react-native-starter-kit.
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
from react-native-starter-kit.
Thank you for accepting my PR, Keep this issue open just in case something pops up.
from react-native-starter-kit.
For sure :) My next objective will be writing documentation for this so anyone can do it.
from react-native-starter-kit.
Just out of interest what has changed or changing in v2?
I've just checked out v2 and two tests are failing
I'll try and have a look into it but I'd just thought I'd let you know :)
from react-native-starter-kit.
Hey @jakelacey2012
Firstly, thanks for starting on testing for v2!
Sorry I'm not too familiar with Jest.
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).
from react-native-starter-kit.
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 react-native-device-info
. This package exports a method in which we can detect the version of the device which we're doing in api.js.
Effectively require('react-native').NativeModules.RNDevice.Info
is undefined this we cannot get the version of the device.
@mcnamee Do you know if there is anything we can do to the react-native-device-info
package, so that we can force it to be something in development/testing mode?
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.
from react-native-starter-kit.
Hey @jakelacey2012
Your solution looks fine to me 👍
from react-native-starter-kit.
Related Issues (20)
- i am not able to build apk. I am using expo cli. HOT 2
- Message
- Help with converting Firebase to standard HTTP library HOT 2
- expo SDK version is outdated HOT 5
- Need to update Expo demo to latest version HOT 7
- yarn install error HOT 3
- [Question - docs] Admin role HOT 1
- Any ideas how to get rid of warnings in dev env? HOT 1
- [Question - docs] I can't find docs about how to run linting HOT 1
- Errors on yarn install HOT 1
- App crashes in Windows 10 HOT 2
- [Q] Any kinf of configuration available? HOT 3
- Can't get .env variables working HOT 5
- Can't start web project HOT 1
- How to change project name and package? HOT 1
- Suggestion: Migration from react-native-router-flux to react-navigation HOT 1
- Suggestion: upgrade to RN 0.64 HOT 2
- r.split is not a function. HOT 2
- Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
- async-storage dependency deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-starter-kit.