-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathslack.spec.js
More file actions
38 lines (26 loc) · 832 Bytes
/
slack.spec.js
File metadata and controls
38 lines (26 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* global describe, it, beforeEach, inject */
'use strict';
describe('slack', function () {
beforeEach(module('angular-slack'));
var Slack,
$httpBackend;
beforeEach(inject(function ($injector) {
Slack = $injector.get('Slack');
$httpBackend = $injector.get('$httpBackend');
}));
describe('#notify', function () {
it('should call http service with correct parameters', function () {
var message = {
'text':'Hello world',
'channel':'@someone',
'username':'angular-slack'
};
var data = {
'payload': message
};
$httpBackend.expectPOST('https://myteam.slack.com/services/hooks/incoming-webhook?token=token', data, undefined).respond(201, '');
Slack.notify('myteam', 'token', message);
$httpBackend.flush();
});
});
});