File tree Expand file tree Collapse file tree 3 files changed +13
-12
lines changed
Expand file tree Collapse file tree 3 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -59,16 +59,20 @@ export default class Company {
5959 industry,
6060 customAttributes,
6161 } : UpdateCompanyData ) {
62- return this . create ( {
63- createdAt,
64- companyId,
62+ const data = {
63+ remote_created_at : createdAt ,
6564 name,
66- monthlySpend,
65+ monthly_spend : monthlySpend ,
6766 plan,
6867 size,
6968 website,
7069 industry,
71- customAttributes,
70+ custom_attributes : customAttributes ,
71+ } ;
72+
73+ return this . client . put < CompanyObject > ( {
74+ url : `/${ this . baseUrl } /${ companyId } ` ,
75+ data,
7276 } ) ;
7377 }
7478 find ( { companyId, name } : FindCompanyData ) {
Original file line number Diff line number Diff line change @@ -28,10 +28,8 @@ const dummyCompany = {
2828 custom_attributes : { } ,
2929} ;
3030describe ( 'companies' , ( ) => {
31- let client : Client ;
32- before ( ( ) => {
33- client = new Client ( 'foo' , 'bar' ) ;
34- } ) ;
31+ const client = new Client ( 'foo' , 'bar' ) ;
32+
3533 it ( 'should be created' , async ( ) => {
3634 const requestBody = {
3735 remote_created_at : dateToUnixTimestamp ( new Date ( ) ) ,
@@ -66,7 +64,6 @@ describe('companies', () => {
6664 it ( 'should be updated' , async ( ) => {
6765 const company_id = '46029' ;
6866 const requestBody = {
69- company_id,
7067 remote_created_at : dateToUnixTimestamp ( new Date ( ) ) ,
7168 name : 'BestCompanyInc.' ,
7269 monthly_spend : 9001 ,
@@ -78,7 +75,7 @@ describe('companies', () => {
7875 } ;
7976
8077 nock ( 'https://api.intercom.io' )
81- . post ( ' /companies' , requestBody )
78+ . put ( ` /companies/ ${ company_id } ` , requestBody )
8279 . reply ( 200 , { } ) ;
8380
8481 const response = await client . companies . update ( {
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { Client } from '../lib';
33import { DataType , ModelType } from '../lib/dataAttribute/dataAttribute.types' ;
44import nock from 'nock' ;
55
6- describe . only ( 'data attributes' , ( ) => {
6+ describe ( 'data attributes' , ( ) => {
77 const client = new Client ( 'foo' , 'bar' ) ;
88
99 it ( 'should create' , async ( ) => {
You can’t perform that action at this time.
0 commit comments