@@ -27,28 +27,52 @@ describe('companies', () => {
2727 done ( ) ;
2828 } ) ;
2929 } ) ;
30- it ( 'find companies by id' , done => {
30+ it ( 'should find companies by id' , done => {
3131 nock ( 'https://api.intercom.io' ) . get ( '/companies/baz' ) . reply ( 200 , { } ) ;
3232 const client = new Client ( 'foo' , 'bar' ) . usePromises ( ) ;
3333 client . companies . find ( { id : 'baz' } ) . then ( r => {
3434 assert . equal ( 200 , r . status ) ;
3535 done ( ) ;
3636 } ) ;
3737 } ) ;
38- it ( 'list company users by id' , done => {
38+ it ( 'should find companies by company_id' , done => {
39+ nock ( 'https://api.intercom.io' ) . get ( '/companies' ) . query ( { company_id : 'baz' } ) . reply ( 200 , { } ) ;
40+ const client = new Client ( 'foo' , 'bar' ) . usePromises ( ) ;
41+ client . companies . find ( { company_id : 'baz' } ) . then ( r => {
42+ assert . equal ( 200 , r . status ) ;
43+ done ( ) ;
44+ } ) ;
45+ } ) ;
46+ it ( 'should find companies by name' , done => {
47+ nock ( 'https://api.intercom.io' ) . get ( '/companies' ) . query ( { name : 'baz' } ) . reply ( 200 , { } ) ;
48+ const client = new Client ( 'foo' , 'bar' ) . usePromises ( ) ;
49+ client . companies . find ( { name : 'baz' } ) . then ( r => {
50+ assert . equal ( 200 , r . status ) ;
51+ done ( ) ;
52+ } ) ;
53+ } ) ;
54+ it ( 'should list company users by id' , done => {
3955 nock ( 'https://api.intercom.io' ) . get ( '/companies/baz/users' ) . reply ( 200 , { } ) ;
4056 const client = new Client ( 'foo' , 'bar' ) . usePromises ( ) ;
4157 client . companies . listUsers ( { id : 'baz' } ) . then ( r => {
4258 assert . equal ( 200 , r . status ) ;
4359 done ( ) ;
4460 } ) ;
4561 } ) ;
46- it ( 'list company users by company_id' , done => {
47- nock ( 'https://api.intercom.io' ) . get ( '/companies' ) . query ( { type : 'user ' , company_id : 'baz' } ) . reply ( 200 , { } ) ;
62+ it ( 'should list company users by company_id' , done => {
63+ nock ( 'https://api.intercom.io' ) . get ( '/companies' ) . query ( { company_id : 'baz ' , type : 'user' } ) . reply ( 200 , { } ) ;
4864 const client = new Client ( 'foo' , 'bar' ) . usePromises ( ) ;
4965 client . companies . listUsers ( { company_id : 'baz' } ) . then ( r => {
5066 assert . equal ( 200 , r . status ) ;
5167 done ( ) ;
5268 } ) ;
5369 } ) ;
70+ it ( 'should list company users by company name' , done => {
71+ nock ( 'https://api.intercom.io' ) . get ( '/companies' ) . query ( { name : 'baz' , type : 'user' } ) . reply ( 200 , { } ) ;
72+ const client = new Client ( 'foo' , 'bar' ) . usePromises ( ) ;
73+ client . companies . listUsers ( { name : 'baz' } ) . then ( r => {
74+ assert . equal ( 200 , r . status ) ;
75+ done ( ) ;
76+ } ) ;
77+ } ) ;
5478} ) ;
0 commit comments