How to Test React App With Jest and Enzyme In Telugu

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
is so you don't run any kind of things in any good property explain jason okay so usually uh first in testing to start yes like what is testing otherwise i just continue with different types of testing logic class international a logic whenever you are getting uh n one n two props values it's event in a a particular functionality energy it has to written an addition of that two prop values like n one and n two surrounding addition that particular test case is failed okay this is an actual process of uh it can able to access an internal works of the component okay easier definition the bottom and attach your ship is we cannot able to do that uh you know jail level kind of validation chilean monitor very simple so i believe guys which can i easily understand like what is mean by react testing library and uh further that party react testing libraries like enzymes and just okay now hope you guys uh understand well you know before the comic recording or explained yesterday react applications at the greatest application so first different official website one is called a testing library so testing library website then cosmetic it is for uh uh referring the documentation of react testing diabetes by default okay and we have a beautiful um you know a wonderful one called chapati and the cosmetic is now most used uh you know kind of testing framework as of in the world super working is just in a testing framework is an enzyme system first one okay so individually enzymes can able to validate and chill level component as well on a component directly validate that is the power of incense okay so you can able to see that we have and three different kind of testing libraries one is in a just stop guys if you just download by default sorry download channel by default just terminally testing libraries got it and some other kind of libraries as well react and use it eventually so user event and then cosmetic on change even handler are going to want anything for testing we can use any user events okay all right guys by default dependency on continuity dependencies they are presented sorry npx great reaction react application connection we could by default okay so these are our main start challenge structure some npm start as yellow one of those new we will have under some kind of script over here surely npm start and just never internet this particular script will be executed so they would think about testing script in the journaling and pm test a particular component law just create an uh kind of uh file name called some some kind of name starting with your own and ending with test.js okay extension should be like test.js i hope you understand guys supposed to have enough we are creating a test case so test case okay description one of the first argument guys so usually on a test case of a test and a functionality we will have in two different documents one will be like in a description and another will be like and component that will make you to understand which particular application i mean which particular test case got failed got it so in the lemon brow syndrome if a particular function so we particularly functionality in the execute option literally in just a day i'm trying to get an app component so create system to create an app component so i have components a particular application a particular component on a testing chair and contain you how to import that particular uh you know what we usually call it as a component okay and our component is just now a component law you know uh no link element and then value another just going on a value so can you see that guys uh screen dot get by text okay and then what i'm trying to do i'm expecting that particular content in you have to provide the command called npm test so most of the people run tests so i'm going with just like npm tests dot json file executable maybe uh one of my applications structure and the time system though so alternative instruments so we have to wait for it definitely and it produces which was showing asking multiple things a 20 kind of ah you know discussion so first one should reacting we are trying to change the content okay so you put your independent test case password in the field definitely want to test case monthly what we're expecting here with the link called learn react but what we have here we're having a loan react okay i mean react learn okay it's done one more test case and a failure in the candidacy out of one portal one test case got failed so it will be checked the same so if one's called up just a month uh why this got failed energy they [Music] they what they are expecting what we get in the place the proper guard spiritual center maybe i'm not sure in the uh you know particular test case you should go what they are expecting what we uh what we got in another that is why this particular test case is failed so again i'm trying to undo the same and i'm saving that so you promote a test case some kind of components are just coaching let me try to uh you know let me try to provide some other components in the learning you know has to tag a channel uh like under this particular thing i can able to provide history tag and then particular has to take low uh a particular content under the underlying situation okay so same thing uh react testing library uh stop jse in enzymes usually testing applications in a maximum most of the people use shell without any kind of uh frameworks any kind of testing from us we can able to test our application energy by default okay so my first enzymes instead of just calling a uh we have to use this particular command if you are using an react with more than 16-point version okay earlier than the 16-point version you have to use these particular packages based on your convenience okay and if a particular portal learning yellow used shall i e20 models my importers and how to uh we how to use kind of testing and equal propagation data definitely within someone's link in description like this okay so we have to install no i'm i'm trying to terminate my statement and we'll try to paste it over here so money for enzymes enzyme adopted download yes that is for interacting react with an enzyme okay maybe it could take some time we'll wait for it that should be the good so we we got installed and science now super enzymes when used is quality definitely we have to import some kind of modules over there so these are actual modules that we used to use for uh using an enzymes so promoting enzymes sorry shares now and i have to uh install i have to import one more uh in a module called shallow simple uh app.json i'm going to use like an own simple ladder function you particularly have a function i'm going to have like an h1 so h1 table i'm having like an hello so maybe like in hello world that should be fine so hello hold on i have a content marker i'm having here so [Music] so very simple guys when the first a particular component input just call it so line produce content very simple app from app.js there should be some modification okay when i'm testing that's in the description are the function and the same kind of under syntax another difference between surrounding testing uh someone should code so in the part of enzymes okay i'm creating a test function so it will take on two arguments one should be like we have to use a description for the file so we then continue for checking h1 content okay h1 tag only content and texture and control and we're going to use an arrow function for executing our test case that should be great so individual further coding letters first i'm going to create a constant variable for storing and the component when a component a component of the tests that is i've been trying to store the component that i would like to test gesture component uh wrapper on a component storage screen here i'm going to use an expect okay so expect we are i'm expecting something from that particular component mx but just a so i'm gonna use like a same a wrapper dot fine so i'm trying to find an h1 tag h1 tag hedge function [Music] kind of thing and here i'm going to use like you know a content should be like a hello world right so i'm going to second hello world excuse me hello world so i'm saving the same we'll see this time it has to work now wow it gets passed so it isn't a very simplest format of testing the application guys so you can hear in russian condition china easy to understand me like i'm trying to expecting some content from h1 tag and that is called hello world here okay the same thing nice miracle raptures that would try to use in a component kind of thing directly on component naming just try to wrap it in this particular greater than interesting symbol so that it will be considered as a part of component okay so many people who need to get a small modification like just and hold on to which challenge not the vote here it is expecting hello world but what we have been provided we have been provided just and hello okay definitely them so that we can understand yeah they could have tested so this time it is got failed and yeah can able to see that now here so it is actually showing that what is expecting and what we received here okay so based on that we can able to modify our component so shouldn't you put it hello world and it's none again and providing the same and this time my test case will be passed because it will satisfy you know expected substring okay my question is multiple kind of uh you know uh test cases good projection but surely what i'm going to do i'm going to provide another test case and that is for hedge to tackle only like you put it has to tackle guys same thing definitely logic implementation definitely present which i'm using i'm trying to uh get some text like uh telugu skill hub okay you know satisfied or not so a particular place loan in just now code mother modification shape of nano and i have to mention over here and i'm trying to checking from h2 tagger net so first i'm trying to clone my variable over here i mean my component over here using a wrapper uh wrapper component flow a particular wrapper variable i'm trying to check and has to drag which means wrapper component in the it is enough uh you know copy of the particular component that we are trying to test cigarette uh no container what i am going to check it is has to happen a telugu skill hub and guys if players flow uppercase and smaller it make more sense some cross checking the same so you would do you know proper no camera definitely this time our two test case will be get passed okay we'll see so either cheap component guys one may particularly include uh what we are expecting anyway surely total two two total got two two test cases and there are two test cases called a power sign okay so what we are expecting as an output is that we are getting so many applications of not good super mechanological implementation logic implementation together so what i'm going to do now props concept name is you know i'm trying to uh expect an h1 tag so h1 tag so let me have the same thing additional i'm going to have like you know some uh due component over here with the id called okay with the id called welcome okay so if you are not using an html level kind of an component then you have to validate using an id okay id provider is validated so a particular component i'm trying to uh provide like a welcome particular professor this is by a particular name and a props dot so very simple i'm trying to use an artist to make to check test cases that is very normal thing test function so in the learning i'm going to have like you know one kind of description for this particular test case which is like testing uh excuse me twisting props okay and then i'm going to have like an arrow function to describe our functionality so we have a function low what i'm going to do i'm going to clone on our is equal to uh john so i'm sending like a john superintendent when i'm trying to clone this particular variable i'm passing the value of uh john with the property name called name okay so name enough variables so welcome that particular name called john welcome john or with another content so you're predicting that uh that has an output based on that we're going to quote right now so yellow quarter but no i'm trying to expect okay i'm trying to expect an output with a wrapper dot fine and i would like to find with an id so even in that h1 and h2 channel in the entire html level component cover you put something on an initial component loading of a valid finch definitely i have to use that my own id okay like new component content in your own identity so i'm trying to use like in the welcome so welcome one of the idea networks i'm trying to use i can hash there so you could have class in the channel i have to use here dot okay instead of this particular hash i have to use dot which is still something this concept will be very easier to understand and return okay and i'm trying to get the text okay this time also i'm trying to get the text and because that is under the part of an between the div tag and here i would like to check uh by using the component called uh to be to be used that should be fine or else you can also use some kind of an um you know to be to contain something like that as well okay that should be like an uh welcome and the particular name that we are expecting like john okay this is a discus uh welcome that particular value that we passed which is like welcome john and what is going to join the past just now so um we'll see so either this time this test case will pass our failed so even when i got china's uppercase smaller case modification again it won't fail surely it could fail in the question failure so can you see this we have been expecting and we have provided in a capital w but monomial small smaller case deportation now okay i told you right this should not be the case so either one of them is not clear slow we have to change the capital case of the small case so this time we it will work in the question these are only error right on property listening which is expecting which is received and say so we'll see this time it will work surely out of three test cases we got past three test cases and a monika props the prop service ngc validate just number so this is highly dynamic proper governmental to declare the state variable so you place one you know i'm going to use like a constant uh you know and a variable articulation click with the use statistics and already use the statement of channeling the videos and guys please monica reactions okay and using a counter over here and excuse me it's a counter okay i'm using a set counter so and here i'm going to use like a use tape and by default value for the counter is zero okay so we couldn't know monica counter direct default and here i'm going to have like an initial okay initial okay initial value so uh initial excuse me this may be spelling mistake so initial underscore value and id law i'm trying to check out what is my counter what is my uh counter variable initial value so simply i'm going to have a gonna counter super one like a counter revolution particularly any particular id value a particular initial initial value an id value i can able to check out see there are trending very so checking instead of having a no description like these we're going to have like a checking state initial okay value that should be good supermarket one eight month essentially definitely that is our wish synthesis and say in the indicating component now we are not providing a priority to the prop side so let it be no need to worry about it and a particular place low we have to use an initial excuse me initial value okay so these are id values in the cosmetically id particular id component we're going to check so content so that's it i'm saving now so we'll see this time it is if it is works then that should be fine come on so almost one for tesco four positive good alone i'm trying to use it as an on click event handler functionality okay so on click event handler and checking that you know pretty sorry button you know i'm trying to use an on click have a stimulate kind of value okay we have such a sanctuary uh where was it uh you just scroll down you just scroll down yeah secretion only they're using a clicking kind of activities even have you can use another stimulator over here okay simulator we have to pass and click like that simply there component i'm going to copy the same and i'm going to use it in our component okay so before using that i would like to create another test over here okay so this is for checking um checking and on click event handler when i can't click even hello or code knowledge picture and cause them i'm gonna use like an arrow function for describing our test case i'm going to use like a constant variable for wrapping out the component with a variable name call with the props called john and then we have to close it out that is another string like that and before that we have to uh you trigger this action molecular dynamic trigger system so simulate dot click on the then cosmetic it will get click on this particular button component so button component on the a particular button component click what i will expect there i will expect my particular uh you know the component name called uh id so a particular id counter value and the one in dollar so in the course monthly then click just okay so it's the same kind of thing but this time i'm going to use them value is called one okay so i think we are around five test cases passing now surely five out of five test cases is passing maybe place one you know uh i think uh instead of one if i try to change to two so in english as a pretty sorry two two two values definitely i mean expecting one but we have been received two okay so my expertise is they should not be too it should be one understand out of five test cases passed so very simple guys and you know bring any functionalities expansion of minority it will take long time mirror sorry documentation and it shouldn't be so 820 components kind of functional decision the proper documentation [Music] just now and they are writing some kind of content for what they are expecting and they make it easy to understand important at all but shouldn't be full documentation make you easy to understand open the aluminum testing application further complement sharing hope you guys uh you know enjoy this video so i believe either dot nagani please let me know in the comment section i will respond as soon as possible guys okay now and guys the first time recently please do like and subscribe guys let me know why you know i'm trying to do my best i need support from you and guys please do like and subscribe this is a very humble request from my end okay and thank you so much guys and see you in a better video and better concept
Info
Channel: Telugu Skillhub
Views: 24,088
Rating: undefined out of 5
Keywords: How to Test React Components Using Jest and Enzyme in telugu, react unit testing in telugu, react unit testing using jest and enzyme in telugu, jest and enzyme in telugu, Unit Testing of React app using Jest and Enzyme in telugu, React Unit Testing Using Enzyme and Jest in telugu, how to test react Using Enzyme and Jest, unit testing of react, testing react app using jest and enzyme in telugu, react testing library in telugu, Test Driven development with jest and enzyme, react tdd
Id: v0eR9nJ7SJE
Channel Id: undefined
Length: 35min 0sec (2100 seconds)
Published: Wed Jul 07 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.