forked from Gainsight/integrations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.outbound.js
61 lines (41 loc) · 1.5 KB
/
test.outbound.js
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
var auth = require('./auth')
, facade = require('segmentio-facade')
, helpers = require('./helpers')
, integrations = require('..')
, should = require('should');
var outbound = new integrations['Outbound']()
, settings = auth['Outbound'];
describe('Outbound', function () {
describe('.enabled()', function () {
it('should only be enabled for all messages', function () {
outbound.enabled(new facade.Track({ channel : 'server' })).should.be.ok;
outbound.enabled(new facade.Track({ channel : 'client' })).should.be.ok;
outbound.enabled(new facade.Track({})).should.be.ok;
});
});
describe('.validate()', function () {
it('should require an api key', function () {
outbound.validate({}, { apiKey : '' }).should.be.an.instanceOf(Error);
outbound.validate({}, {}).should.be.an.instanceOf(Error);
should.not.exist(outbound.validate({}, { apiKey : 'xxx' }));
});
});
describe('.track()', function () {
it('should track successfully', function (done) {
var track = helpers.track();
outbound.track(track, settings, done);
});
});
describe('.identify()', function () {
it('should track successfully', function (done) {
var identify = helpers.identify();
outbound.identify(identify, settings, done);
});
});
describe('.alias()', function () {
it('should do nothing', function (done) {
var alias = helpers.alias();
outbound.alias(alias, settings, done);
});
});
});