ddcornwall / nara-alaskana

National Archives Alaskana Explorer
1 stars 0 forks source link

Write unit tests #29

Open digilou opened 6 years ago

digilou commented 6 years ago

Even a small scale app should have tests written for it. In this case, TDD (test-driven dev) would work, unless you want to go BDD (behavior-driven dev). Jest is a popular library to use right now. If you don't want to go with all-the-things Facebook, Mocha is another option.

One perk of tests, it helps you think about what the user is trying to accomplish or expect, and helps keep your functions smaller.

ddcornwall commented 6 years ago

This seems like a good time to embrace best practice. I admit at the current time I don't know the difference between TDD and BDD. I have HEARD of Unit testing and may have watched a video or two but didn't sink in at the time. Can you recommend a good resource for learning more on this topic?

digilou commented 6 years ago

Well, I've only really practiced with Rails, which can go TDD or BDD. More Rails devs lean BDD and use RSpec or Cucumber. Tutorials naturally cover this because it's just the Rails way. I need to research for JS apps. I like BDD because you think in terms of what actions the user is taking. TDD is more robotic to make sure this function works a specific way.