@@ -46,11 +46,46 @@ describe("Test request method", () => {
46
46
} ) ;
47
47
48
48
it ( "should make GET request - GET Customers" , async ( ) => {
49
- expect . assertions ( 1 ) ;
49
+ expect . assertions ( 4 ) ;
50
50
const response = await client . request ( {
51
51
path : "record/v1/customer/" ,
52
52
} ) ;
53
53
expect ( response . statusCode ) . toEqual ( 200 ) ;
54
+ expect ( response . data ) . toBeDefined ( ) ;
55
+ expect ( response . data . items ) . toBeDefined ( ) ;
56
+ expect ( response . data . count ) . toBeDefined ( ) ;
57
+ } ) ;
58
+
59
+ it ( "should make POST request - POST Customers" , async ( ) => {
60
+ const response = await client . request ( {
61
+ path : "record/v1/customer/" ,
62
+ method : "POST" ,
63
+ body : JSON . stringify ( {
64
+ entityStatus : 6 ,
65
+ firstName : "firstName" ,
66
+ lastName : "lastName" ,
67
+ subsidiary : "1" ,
68
+ companyName : "netsuite-api-client-integration-test" ,
69
+ } ) ,
70
+ } ) ;
71
+
72
+ expect ( response . statusCode ) . toEqual ( 204 ) ;
73
+ expect ( response . data ) . toBeDefined ( ) ;
74
+ expect ( response . data ) . toBeNull ( ) ;
75
+ expect ( response . headers . location ) . toBeDefined ( ) ;
76
+
77
+ const location = response . headers . location as string ;
78
+
79
+ // extract id from location string
80
+ const id = location . split ( "/" ) . pop ( ) ;
81
+
82
+ // delete the created company
83
+ const responseDelete = await client . request ( {
84
+ path : `record/v1/customer/${ id } ` ,
85
+ method : "DELETE" ,
86
+ } ) ;
87
+
88
+ expect ( responseDelete . statusCode ) . toEqual ( 204 ) ;
54
89
} ) ;
55
90
56
91
it ( "should make POST request - SuiteQL Query" , async ( ) => {
0 commit comments