Add additional test for testing failure after delete

This commit is contained in:
Gabe Kangas 2023-04-03 21:13:03 -07:00
parent 74f076f44b
commit ac7d655a14
No known key found for this signature in database
GPG key ID: 4345B2060657F330

View file

@ -23,9 +23,7 @@ test('create webhook', async (done) => {
}); });
test('check webhooks', (done) => { test('check webhooks', (done) => {
getAdminResponse('webhooks').then((res) => {
getAdminResponse('webhooks')
.then((res) => {
expect(res.body).toHaveLength(1); expect(res.body).toHaveLength(1);
expect(res.body[0].url).toBe(webhook); expect(res.body[0].url).toBe(webhook);
expect(res.body[0].events).toStrictEqual(events); expect(res.body[0].events).toStrictEqual(events);
@ -43,8 +41,7 @@ test('delete webhook', async (done) => {
}); });
test('check that webhook was deleted', (done) => { test('check that webhook was deleted', (done) => {
getAdminResponse('webhooks') getAdminResponse('webhooks').then((res) => {
.then((res) => {
expect(res.body).toHaveLength(0); expect(res.body).toHaveLength(0);
done(); done();
}); });
@ -157,3 +154,14 @@ test('check token delete was successful', async (done) => {
done(); done();
}); });
test('send an external integration action using access token expecting failure', async (done) => {
const payload = {
body: 'This is a test external action from the automated integration test',
};
await request
.post('/api/integrations/chat/action')
.set('Authorization', 'Bearer ' + accessToken)
.send(payload)
.expect(401);
done();
});