Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix Imgur Unit Tests #101
Imgur unit tests fail
I believe this is happening because the
Looking at this line of code in
This is an easy fix
After some debugging, it is still unclear whether or not this issue is related to mockImgur or not.
The guilty test case is the
When running only the first imgur test method, the undefined imgur error does not appear. This should narrow down the error to just the second test case within these imgur tests.
Debugging is still an ongoing process.
Unit tests are supposed to mock out imgur, so require('imgur') is not needed. If the test is failing it could be because MockImgur doesn't have a function that we need to mock that we need to add.
The URL at ritlug.com never existed. Because we mock out imgur, it never actually queried ritlug, and never actually uploaded anything to imgur. The purpose of those unit tests is if imgur were to return a successful JSON message, does the correct message get relayed to IRC. The other unit test is if imgur were to return a failure by throwing an exception, does the ImgurHandler handle it okay.
photoNotInImgur purposefully does not have an imgurUrl field so MockImgur's upload URL does the failure case.
If we want to actually want to query ritlug.com and imgur, it is no longer a unit test; it is an integration/acceptance test.
So, after extensive debugging, I've come to the conclusion that there's nothing really to fix. The only issue I see, is that when calling
@xforever1313 is this supposed to be the case? Or is it supposed to return an error because it doesn't have an imgur url?
Either way, both options have the same end result, with