test driving (tdd) a react.js ui component with jasmine

16
Naresh Jain @nashjain http://nareshjain.com Test Driving React.js

Upload: naresh-jain

Post on 22-Jan-2018

1.115 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Test Driving (TDD) a React.js UI Component with Jasmine

Naresh Jain @nashjain

http://nareshjain.com

Test Driving React.js

Page 2: Test Driving (TDD) a React.js UI Component with Jasmine

OO= Modelling Real World

Page 3: Test Driving (TDD) a React.js UI Component with Jasmine

…And soon

Page 4: Test Driving (TDD) a React.js UI Component with Jasmine
Page 5: Test Driving (TDD) a React.js UI Component with Jasmine

Classic Debate

Page 6: Test Driving (TDD) a React.js UI Component with Jasmine

OO Gets A Bad Name

X

Page 7: Test Driving (TDD) a React.js UI Component with Jasmine

O O + F P + T D DT H I S W O R K S H O P I S A B O U T …

Page 8: Test Driving (TDD) a React.js UI Component with Jasmine

A G E N D A - 4 5 M I N S

• Basic Setup (WebStorm, NPM, Jasmine, Karma, …)

• Code Walk Thru of Test Driving a Comments react component

• Next Steps…

Page 9: Test Driving (TDD) a React.js UI Component with Jasmine

W E P L A N T O B U I L D T H I S …

Page 10: Test Driving (TDD) a React.js UI Component with Jasmine

Add a Test

Run the Test

Make a little change

Run the Test

Refactor

Fail

Pass

Fail

Pass

TDD Rhythm Test, Code, Refactor

Page 11: Test Driving (TDD) a React.js UI Component with Jasmine

B A S I C S E T U P

• git clone [email protected]:nashjain/React-Karma-Jasmine-Webpack-Babel-ES6-JS.git

• cd React-Karma-Jasmine-Webpack-Babel-ES6-JS

• npm update

• npm run test

• should see 32 tests pass

• Open the project in WebStorm

• Right click on karma.conf.js and select “Run karma.conf.js”

• should see 32 tests pass

Page 12: Test Driving (TDD) a React.js UI Component with Jasmine

Commercial Break!

Page 13: Test Driving (TDD) a React.js UI Component with Jasmine

Copyright © 2012, AgileFAQs. All Rights

Page 14: Test Driving (TDD) a React.js UI Component with Jasmine

O U R P L U G I N ’ S F E AT U R E S

• Should be able to accept a comments json and display the comments

• Should display most popular (with max likes) comments on top

• If 2 comments have same likes, then the most recent comment on top

• Private comments should be displayed only to the author of the comment

• Others should be able to like your comment

• and so on…

Page 15: Test Driving (TDD) a React.js UI Component with Jasmine

R E F E R E N C E S

• https://facebook.github.io/react/

• http://karma-runner.github.io/

• http://webpack.github.io/

• http://jasmine.github.io/edge/introduction.html

• https://github.com/airbnb/enzyme

• https://github.com/jasmine/jasmine-ajax

Page 16: Test Driving (TDD) a React.js UI Component with Jasmine

Naresh Jain @nashjain

http://nareshjain.com

Thank you!