Thisisgoingtobeourtestinglibraryandthereasonwe'resavingitas a developmentdependencyisbecauseweonlyusethistestinglibraryindevelopmenttomakesureeverythingruns.
Nowthatthatisdonedownloadingwecancomeinhere.
Wehaveourtest, a script, andwecanjustchangethisbytypinginjest.
Andthere's a lotoffunctionswecanuse, forexample, tobetwoequal, nottobe, tobeknoll, tobeundefinedandsoon.
There's quite a lotofdifferentmatchesthatyoucoulduseinthiscasebefore a simpleexampleoverdoingischeckingthatoneplustwoisthesameasthreeandinourcasethatpastandrancorrectly.
Thevalueseemstobethesame, butthey'reactuallydifferentplacesandmemorybecause, remember, I said, CloneArray.
Thisisactuallycreating a brandnewarraywithallofthesamevalues.
Sonowwehavetwoarraysthatarebothreferencing.
Theywon't havethesamevalue, butthey'rereferencedbydifferentmemoryaddresses, andthissounds a littlebitconfusing, but I haveanentirevideoonpassedbyvalueandpassedbyreference.
But I breakthisdowninsoyoucancheckthatoutlinkedinthecardsandthedescriptionbelow.
Sowemadesureourrayisthesamearray 123 Andwealsomadesurethatitcreated a cloneinsteadofjustreturningtheexactsamearray, itcreated a cloneofthatarray a littlebitconfusing.
Butas I mentioned, youcancheckoutthatvideoandit'llbreakdownpastmyreferenceandpassbyvalueforyoureallyeasily.
Now.
Onelastthingwewoulddoislet's create a testforsubtractdottestdotJsandinsteadofhere, I'm gonnacopyaresometestbecauseit's goingtobeverysimilar.
Andifweclickonit, youcanseeinredisallthesectionsthatarenotbeingtested, whichmakesitreallyeasytoknowifwe'reactuallytestingeverythingthatwewanttotestNow, before I dieofanyfurther, I wanttostepback a littlebitandtalkabouttestingas a whole.
Sonowyouknow, ifyourtestfor a singleunitfailedthatthatsingleunitisbrokenandyouknowexactlywheretogotofixit.
Also, itallowsyoutowritereallysmalltestbecauseyou'reonlytesting a smallpartofyourcode, soyouonlyneedtomakesureinputsandoutputsforthatverysmallsectionofcodearewhatyouexpect.