tuantvk / wtfreactnativetesting Goto Github PK
View Code? Open in Web Editor NEWTesting React Native Apps :heavy_check_mark: :white_check_mark:
License: MIT License
Testing React Native Apps :heavy_check_mark: :white_check_mark:
License: MIT License
Thanks for the demo. Really helpful for the beginners. One thing I saw while reading react-native-testing-library docs is, it states that it is a replacement for Enzyme here.
So do we really need to add Enzyme to replicate your tutorial? I haven't actually started to write my tests yet.
In Login.js
i use text.replace(/[^0-9]/g, '')
get number from text set to phone number.
and test changeText phone:
it('change text is string to phone input ', () => {
const { getByTestId } = render(<Login />);
fireEvent.changeText(getByTestId('phone'), 'isstring');
expect(getByTestId('phone').props.value).toEqual('');
});
How to improve it use jest or lib other ?
If there is test code that should be wrapped in act(...) then the current warning is given:
console.error node_modules/react-dom/cjs/react-dom.development.js:506
Warning: An update to null inside a test was not wrapped in act(...).
When testing, code that causes React state updates should be wrapped into act(...):
act(() => {
/* fire events that update state */
});
/* assert on the output */
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://fb.me/react-wrap-tests-with-act
i config in jestSetup.js
hidden it
How to fix it ?.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.