Open TimBMK opened 2 years ago
@TimBMK TODO
devtools::document()
; commit also bind_errors.Rd
Do you know how to write tests? If yes, it would be useful.
I've added the doc files. I'm not familiar with tests other than the basic devtools::check() though. I took a look at your Guide for writing tests, but that only covers handling the dummy API. I can write some tests if you give me some pointers though
I've added some test data and a test for bind_errors(). I've basically copied the bind_tweets() tests, since the functionality is more or less equal. Let me know if that's what you'd expect from the tests!
Edit: looks like test coverage is still failing. Could you explain to me why @chainsawriot ?
@TimBMK One of the possible reasons is that many tests assume an envvar TWITTER_BEARER
. For PRs from your Github, you can't access the TWITTER_BEARER envvar @cjbarrie has set up here as a Github Secret. I suggest you trying to setup such envvar in your own Github as a secret (just a bogus one will do, you don't need to put your actual bearer token in the envvar).
If it still doesn't work, I will try to merge it to a secondary branch here and see how it goes.
@TimBMK I can run (and pass) those bind_errors
tests on my machine. So, it is probably due to the Github Secret.
Bumping this. Will this now pass given changed we've made to the gh actions?
It would be great if it did, it also seems a little strenuous having to go via @chainsawriot for the actual commits every time. I'm still not sure why the tests fail on my side, I set up the TWITTER_BEARER Secret months ago
I've added support for the error capturing mechanism to get_all_tweets() and get_user_timeline(). Among other things, this may help with issue #307, as it provides more variety in terms of test data. In practice I also found it useful to capture errors when retrieving timelines or tweets, as it gives useful information on the data retrieved (e.g., when less data than expected is returned). Furthermore, I added a convenience function to bind errors into a dataframe, comparable to bind_tweets.
All functions that rely on make_query() directly rather than get_tweets() currently do not support error capturing, as they do not store their output in .json files. Looking forward, we might consider adding error capturing mechanisms for these functions as well.
This should not interfere with #308, as the naming conventions remain unchanged. binderrors() merely gathers .json files with the "errors" prefix. The changes in get_all_tweets() and get_user_timeline() only add the "error" T/F variable to be passed on to get_tweets().