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 tests for scripts calling Auth? #47

Open
IAmPatrickB opened this issue Oct 4, 2016 · 2 comments
Open

unit tests for scripts calling Auth? #47

IAmPatrickB opened this issue Oct 4, 2016 · 2 comments
Labels

Comments

@IAmPatrickB
Copy link
Contributor

Has anyone written unit tests for scripts that include/call hubot-auth? I haven't found any solid examples of how to stub out the 'hasRole' or 'isAdmin' functions. I've played around with my own using sinonjs, but when I finally get it passing, the script actually doesn't work in chat, and a working script doesn't pass the unit tests. It also requires modification to auth.coffee in order to get it to pass the test.

I'm guessing I'm probably doing it wrong. Has anyone stubbed this out before?

@sebastiandero
Copy link
Contributor

sebastiandero commented Jan 10, 2017

@GSAgentP I dont think unit tests are possible when implementing hubot listener function, i recommend you pull out everything you can using methods, which you can test.

@sebastiandero
Copy link
Contributor

@GSAgentP nvm, just figured out it is indeed possible hubot-test-helper is the package you need to be looking at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants