forked from Gainsight/integrations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.commandiq.js
63 lines (44 loc) · 1.57 KB
/
test.commandiq.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
62
63
var facade = require('segmentio-facade')
, helpers = require('./helpers')
, integrations = require('..')
, should = require('should')
, settings = require('./auth.json')['CommandIQ']
, ciq = new integrations['CommandIQ']();
describe('CommandIQ', function () {
describe('.enabled()', function () {
it('should only be enabled for all messages', function () {
ciq.enabled(new facade.Alias({ channel : 'server' })).should.be.ok;
ciq.enabled(new facade.Alias({ channel : 'client' })).should.be.ok;
ciq.enabled(new facade.Alias({})).should.be.ok;
});
});
describe('.validate()', function () {
it('should require an apiKey', function () {
ciq.validate({}, {}).should.be.an.instanceOf(Error);
ciq.validate({}, {apiKey : '' }).should.be.an.instanceOf(Error);
});
it('should validate with the required settings', function () {
should.not.exist(ciq.validate({}, { apiKey : 'xxx' }));
});
});
describe('.track()', function () {
it('should get a good response from the API', function (done) {
var track = helpers.track();
ciq.track(track, settings, done);
});
});
describe('.identify()', function () {
it('should get a good response from the API', function (done) {
var identify = helpers.identify();
ciq.identify(identify, settings, done);
});
});
describe('.alias()', function () {
it('should do nothing', function (done) {
ciq.alias({}, {}, function (err) {
should.not.exist(err);
done();
});
});
});
});