Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit testing #1

Open
jonahsnider opened this issue Jul 25, 2019 · 3 comments
Open

Unit testing #1

jonahsnider opened this issue Jul 25, 2019 · 3 comments

Comments

@jonahsnider
Copy link

jonahsnider commented Jul 25, 2019

You can relatively easily have unit testing for API requests by using libraries like Sinon. I created a package very similar to this and it had unit testing for nearly every request variation, with around 90% test coverage.

The test code is open source, here's an example file that uses moxios, sinon, and TAP for botlist.space.

@PassTheMayo
Copy link
Contributor

This sounds great, but wouldn't this require a test bot to be submitted to each list? Having a bot listed in every list sounds like something that would be difficult to maintain. I'll be cleaning up the code some more this weekend, and doing some manual testing.

@MattIPv4
Copy link
Member

Just as food for thought on test lib, we use Mocha & Chai (chai-http) for testing BotBlock itself (web rendering & API).

@jonahsnider
Copy link
Author

jonahsnider commented Jul 26, 2019

but wouldn't this require a test bot to be submitted to each list?

You misunderstood what I meant.

In your code, when you send a request to BotBlock, the request would be intercepted by a testing library (I used moxios) and allow you to compare the sent request to what should have been sent,.

@PassTheMayo PassTheMayo pinned this issue Dec 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants