forked from intercom/intercom-node
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnote.js
30 lines (29 loc) · 994 Bytes
/
note.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
import assert from 'assert';
import {Client} from '../lib';
import nock from 'nock';
describe('notes', () => {
it('should be created', done => {
nock('https://api.intercom.io').post('/notes', { foo: 'bar' }).reply(200, {});
const client = new Client('foo', 'bar').usePromises();
client.notes.create({ foo: 'bar' }).then(r => {
assert.equal(200, r.statusCode);
done();
});
});
it('should list', done => {
nock('https://api.intercom.io').get('/notes').query({ foo: 'bar' }).reply(200, {});
const client = new Client('foo', 'bar').usePromises();
client.notes.list({ foo: 'bar' }).then(r => {
assert.equal(200, r.statusCode);
done();
});
});
it('should find notes by id', done => {
nock('https://api.intercom.io').get('/notes/bar').reply(200, {});
const client = new Client('foo', 'bar').usePromises();
client.notes.find({ id: 'bar' }).then(r => {
assert.equal(200, r.statusCode);
done();
});
});
});