Closed kilianc closed 8 years ago
What would you recommend to use as a test suite? The only reason why I haven't done this yet is I'd like to mock all requests and since their responses are images, I wasn't sure what the best approach was. Thoughts?
yeah all good points, what I would do is to save images locally, and use nock
to pretend they come from the server. You can also test status codes !== 200 and every time someone reports a new issue you just create / mock that use case or the response that caused it.
I actually decided to go with the basic mocha
and assert
setup. Here is the initial inklings of testing: https://github.com/jakiestfu/himawari.js/commit/f92525adf600aa20c0145bf16bacff2263d8fe8c
I will kinda have to rethink the library architecture to make things easier to test, but I'm not too worried. All I've tested is the date resolver and it uses knock
to snuff out the latest.json
request.
Started the test suite in 1.3.0, will continue to add more!
I was actually gonna submit a PR, but I realized there is no test suite which makes it hard for people to contribute to this.