|
| 1 | +import assert from 'assert'; |
| 2 | +import {Client} from '../lib'; |
| 3 | +var nock = require('nock'); |
| 4 | + |
| 5 | +describe('counts', function () { |
| 6 | + it('app counts', function (done) { |
| 7 | + nock('https://api.intercom.io').get('/counts').reply(200, {}); |
| 8 | + let client = new Client('foo', 'bar'); |
| 9 | + client.counts.appCounts(function (r) { |
| 10 | + assert.equal(200, r.status); |
| 11 | + done(); |
| 12 | + }); |
| 13 | + }); |
| 14 | + it('conversation app counts', function (done) { |
| 15 | + nock('https://api.intercom.io').get('/counts').query({ type: 'conversation' }).reply(200, {}); |
| 16 | + let client = new Client('foo', 'bar'); |
| 17 | + client.counts.conversationCounts(function (r) { |
| 18 | + assert.equal(200, r.status); |
| 19 | + done(); |
| 20 | + }); |
| 21 | + }); |
| 22 | + it('conversation admin counts', function (done) { |
| 23 | + nock('https://api.intercom.io').get('/counts').query({ type: 'conversation', count: 'admin' }).reply(200, {}); |
| 24 | + let client = new Client('foo', 'bar'); |
| 25 | + client.counts.conversationAdminCounts(function (r) { |
| 26 | + assert.equal(200, r.status); |
| 27 | + done(); |
| 28 | + }); |
| 29 | + }); |
| 30 | + it('user tag counts', function (done) { |
| 31 | + nock('https://api.intercom.io').get('/counts').query({ type: 'user', count: 'tag' }).reply(200, {}); |
| 32 | + let client = new Client('foo', 'bar'); |
| 33 | + client.counts.userTagCounts(function (r) { |
| 34 | + assert.equal(200, r.status); |
| 35 | + done(); |
| 36 | + }); |
| 37 | + }); |
| 38 | + it('user segment counts', function (done) { |
| 39 | + nock('https://api.intercom.io').get('/counts').query({ type: 'user', count: 'segment' }).reply(200, {}); |
| 40 | + let client = new Client('foo', 'bar'); |
| 41 | + client.counts.userSegmentCounts(function (r) { |
| 42 | + assert.equal(200, r.status); |
| 43 | + done(); |
| 44 | + }); |
| 45 | + }); |
| 46 | + it('company tag counts', function (done) { |
| 47 | + nock('https://api.intercom.io').get('/counts').query({ type: 'company', count: 'tag' }).reply(200, {}); |
| 48 | + let client = new Client('foo', 'bar'); |
| 49 | + client.counts.companyTagCounts(function (r) { |
| 50 | + assert.equal(200, r.status); |
| 51 | + done(); |
| 52 | + }); |
| 53 | + }); |
| 54 | + it('company segment counts', function (done) { |
| 55 | + nock('https://api.intercom.io').get('/counts').query({ type: 'company', count: 'segment' }).reply(200, {}); |
| 56 | + let client = new Client('foo', 'bar'); |
| 57 | + client.counts.companySegmentCounts(function (r) { |
| 58 | + assert.equal(200, r.status); |
| 59 | + done(); |
| 60 | + }); |
| 61 | + }); |
| 62 | + it('company user counts', function (done) { |
| 63 | + nock('https://api.intercom.io').get('/counts').query({ type: 'company', count: 'user' }).reply(200, {}); |
| 64 | + let client = new Client('foo', 'bar'); |
| 65 | + client.counts.companyUserCounts(function (r) { |
| 66 | + assert.equal(200, r.status); |
| 67 | + done(); |
| 68 | + }); |
| 69 | + }); |
| 70 | +}); |
0 commit comments