Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
botkit-mock
Advanced tools
Botkit-Mock - Write tests for Botkit.
npm install --save botkit-mock
botkit-mock
in your test: ie const mock = require('botkit-mock');
const fileBeingTested = require("../controllers/indexController")
In your beforeEach
, setup a mock controller and pass it to fileBeingTested
.
const assert = require('assert');
const mock = require('botkit-mock');
const fileBeingTested = require("../indexController");
describe("controller tests",()=>{
beforeEach((done)=>{
var self = this;
self.slackId = 'some id'
self.userName = 'some username'
self.controller = new mock.controller()
fileBeingTested(self.controller.bot,self.controller)
done();
});
In your it
statement, use the controller.usersInput
method to define the conversation.
it('should return hello', (done)=>{
var self = this;
return self.controller.usersInput([{
type: null,
first:true,
messages:[{text: 'quick', isAssertion:true}]
}]).then((text)=>{
assert.equal(text, 'hello')
done();
})
});
});
You can specify options to usersInput
.
first
- indicates which user spoke first in multi-user testing.
deep
- indicates the index of the conversation response to return in .then()
. 0 is the last response, 1 is the second-to-last, etc..
isAssertion
- indicates which conversation response array to return in .then()
in multi-user testing.
See examples here.
Built by the team at https://www.gratify.chat.
FAQs
Write tests for botkit.
The npm package botkit-mock receives a total of 30 weekly downloads. As such, botkit-mock popularity was classified as not popular.
We found that botkit-mock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.