JonWash86 / Bonsai-Radio

A playlist management application which leverages the spotify and last.fm apis to bring joy to music nerds
http://www.bonsairadio.com
1 stars 1 forks source link

[low-priority] unit tests #15

Open jrheard opened 5 years ago

jrheard commented 5 years ago

find something to write tests for, and test it!

a lot of this project is about making API calls and wiring up event handlers and stuff - that stuff isn't so easy to test. but there's an occasional pure function in there, eg idMatcher(). pure functions are easy to test - you just give them some inputs and assert that their output is what you expect, and you're done!

you'll need to do some research on the javascript/node unit testing landscape to see what the best libraries / practices / etc are, i'm not familiar with that scene at all in this language/environment.

you already know this, but: tests are useful because they give you confidence that your code changes don't break your program. they're also useful because they encourage you to write code that's less tangly and side-effecty, because tangly side-effecty code is really difficult to test! the more parts of your app you can test, the better you'll sleep at night, because you'll have good test coverage and your code will be simpler and easier to understand and make changes to in the future.

this isn't something you need to do right this minute, but it'd be worth doing within the next few months!