feed-master icon indicating copy to clipboard operation
feed-master copied to clipboard

Improve tests coverage

Open umputun opened this issue 3 years ago • 3 comments

The overall coverage is not what impressive and there are a few important files/units we would like to cover first:

  • proc/processor.go - not tested, but should be easy to do, all deps in interfaces already
  • proc/twitter.go - the primary method Send is not covered. Needs some abstractions for testing as it hits anaconda directly
  • main.go - we need some integration tests. Running a local httptest to serve feeds with local mp3 and check resulting feed will be very nice. main has no termination support which needed to such a test
  • proc/telegram.go - Send is not covered #87

umputun avatar Apr 24 '22 18:04 umputun

I'm looking at proc/processor.go but have a couple of questions:

  1. There is a direct http call in rss, err := feed.Parse(url). Shouldn't we add an abstraction here as well?

  2. I'm not sure how to correctly terminate for {} loop in the processor's Do func. I guess it should be some mechanism that can be used to implement termination in the main.go integration test as well.

romangr avatar Apr 25 '22 17:04 romangr

I'm not sure how to correctly terminate for {} loop in the processor's Do

We just need to support ctx as a first parameter and use it for cancelation

There is a direct http call in rss, err := feed.Parse(url). Shouldn't we add an abstraction here as well?

I'm not sure if it is really necessary, because we can make httptest.Server to respond to URL without any mocking of feed.Parse

umputun avatar Apr 25 '22 18:04 umputun

OK, thx for your answers, I'll try to implement it this week

romangr avatar Apr 25 '22 20:04 romangr