Open IAmPatrickB opened 7 years ago
@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.
@GSAgentP nvm, just figured out it is indeed possible hubot-test-helper is the package you need to be looking at
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?