jakiestfu / himawari.js

Download real-time images of Earth from the Himawari-8 satellite
http://jakiestfu.github.io/himawari.js/demo/
MIT License
1.81k stars 103 forks source link

missing test suite :) #17

Closed kilianc closed 8 years ago

kilianc commented 8 years ago

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.

jakiestfu commented 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?

kilianc commented 8 years ago

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.

jakiestfu commented 8 years ago

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.

jakiestfu commented 8 years ago

Started the test suite in 1.3.0, will continue to add more!