Slack hooks fixes and improvements

closes #533
This commit is contained in:
Tom Moor
2018-01-28 19:37:14 -08:00
parent 97268314fe
commit f870cd88bc
3 changed files with 11 additions and 4 deletions

View File

@ -65,18 +65,20 @@ describe('#hooks.slack', async () => {
});
it('should return search results', async () => {
const { user } = await seed();
const { user, document, collection } = await seed();
const res = await server.post('/api/hooks.slack', {
body: {
token: process.env.SLACK_VERIFICATION_TOKEN,
user_id: user.slackId,
text: 'Welcome',
text: document.title,
},
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.attachments.length).toEqual(1);
expect(body.attachments[0].title).toEqual(document.title);
expect(body.attachments[0].footer).toEqual(collection.name);
});
it('should error if unknown user', async () => {