fix: add support for help slack command

This commit is contained in:
Tom Moor
2019-06-25 20:43:59 -07:00
parent 46ad1feb96
commit c9c5e43389
2 changed files with 47 additions and 3 deletions

View File

@ -128,6 +128,34 @@ describe('#hooks.slack', async () => {
);
});
it('should respond with help content for help keyword', async () => {
const user = await buildUser();
const res = await server.post('/api/hooks.slack', {
body: {
token: process.env.SLACK_VERIFICATION_TOKEN,
user_id: user.serviceId,
text: 'help',
},
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.text.includes('How to use')).toEqual(true);
});
it('should respond with help content for no keyword', async () => {
const user = await buildUser();
const res = await server.post('/api/hooks.slack', {
body: {
token: process.env.SLACK_VERIFICATION_TOKEN,
user_id: user.serviceId,
text: '',
},
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.text.includes('How to use')).toEqual(true);
});
it('should respond with error if unknown user', async () => {
const res = await server.post('/api/hooks.slack', {
body: {