cjwilburn / dank-memes

A CLI meme generator.
15 stars 14 forks source link

write unit test for dankest dungeon meme generator in avajs #51

Open cjwilburn opened 5 years ago

cjwilburn commented 5 years ago

Summary

Write unit tests for dankest-dungeon.js in ava

GhostToast commented 5 years ago

Grabbing this one, thanks!

stevefai commented 5 years ago

Hello @GhostToast , I'm going to create a pull request integrating ava over the course of this day, just letting you know to avoid conflicts.

GhostToast commented 5 years ago

@stevefai thanks, i look forward to it. i've not used it yet so i'm muddling through so far. happy to help w/ any conflicts as they arrive.

GhostToast commented 5 years ago

@stevefai here is my initial progress, not working so far. but the test suite is installed. i think "make test" was a placeholder in the package.json file - but maybe there's another approach. in case this is useful to you (i've never used ava) - otherwise happy to wait for your example. it will be interesting to find ways to put assertions in some of these since most of it is console logging haha. probably will have to alter how some of the files operate, more subfunctions, etc. https://github.com/cjwilburn/dank-memes/compare/dankest-dungeon-tests?expand=1

stevefai commented 5 years ago

@GhostToast this was just merged #62 , it should make testing a bit easier.

If you refactor dankest-dungeon.js to use console-reader instead, you can then replace calls to console-reader.question with stubs while testing and everything should go smoothly.

For creating stubs, maybe we should use SinonJS. My pull request for this will come just tomorrow though.

GhostToast commented 5 years ago

At this point I've made no progress, mostly due to being busy. I'm unassigning this from myself in case someone else wants to give it a go cc @cjwilburn @stevefai

cjwilburn commented 5 years ago

Thanks @GhostToast for the heads-up