@@ -122,23 +122,11 @@ describe("transaction", () => {
122122 } ) ;
123123
124124 it ( "put returns successful response" , async ( ) => {
125- const mockResponseBody : TransactionResource = ( {
126- id : "12345678" ,
127- company_name : "HELLO LTD" ,
128- company_number : "88" ,
129- links : {
130- self : "/self"
131- } ,
132- reference : "ref" ,
133- description : "desc"
134- } ) ;
135-
136125 const mockPutResponse = {
137126 headers : {
138127 "X-Payment-Required" : "http://link-to-payment"
139128 } ,
140- status : 202 ,
141- body : mockResponseBody
129+ status : 202
142130 } ;
143131
144132 sinon . stub ( requestClient , "httpPut" ) . resolves ( mockPutResponse ) ;
@@ -148,11 +136,6 @@ describe("transaction", () => {
148136 expect ( data . httpStatusCode ) . to . equal ( 202 ) ;
149137 const castedData : ApiResponse < Transaction > = data as ApiResponse < Transaction > ;
150138 expect ( castedData . headers [ "X-Payment-Required" ] ) . to . equal ( "http://link-to-payment" ) ;
151- expect ( castedData . resource . companyName ) . to . equal ( mockResponseBody . company_name ) ;
152- expect ( castedData . resource . companyNumber ) . to . equal ( mockResponseBody . company_number ) ;
153- expect ( castedData . resource . links . self ) . to . equal ( mockResponseBody . links . self ) ;
154- expect ( castedData . resource . reference ) . to . equal ( mockResponseBody . reference ) ;
155- expect ( castedData . resource . description ) . to . equal ( mockResponseBody . description ) ;
156139 } ) ;
157140
158141 it ( "put returns an error response on failure" , async ( ) => {
@@ -169,12 +152,4 @@ describe("transaction", () => {
169152 const castedData : ApiErrorResponse = data ;
170153 expect ( castedData . errors [ 0 ] ) . to . equal ( "Unprocessable Entity" ) ;
171154 } ) ;
172-
173- it ( "put returns an error response if id is not present" , async ( ) => {
174- const transaction : TransactionService = new TransactionService ( requestClient ) ;
175- const data = await transaction . putTransaction ( { } as Transaction ) ;
176- expect ( data . httpStatusCode ) . to . equal ( 400 ) ;
177- const castedData : ApiErrorResponse = data ;
178- expect ( castedData . errors [ 0 ] . error ) . to . equal ( "Cannot update transaction - id not found" ) ;
179- } ) ;
180155} ) ;
0 commit comments