@@ -51,6 +51,16 @@ describe("PSC Verification Link", () => {
5151 expect ( data . httpStatusCode ) . to . equal ( StatusCodes . INTERNAL_SERVER_ERROR ) ;
5252 expect ( data . errors ?. [ 0 ] ) . to . equal ( ReasonPhrases . INTERNAL_SERVER_ERROR ) ;
5353 } ) ;
54+
55+ it ( "uses provided headers" , async ( ) => {
56+ const mockRequest = sinon . stub ( requestClient , "httpPost" ) . resolves ( mockPscVerificationCreatedResponse [ 201 ] ) ;
57+
58+ const headers = { "X-Request-Id" : "random-uuid" } ;
59+ await pscService . postPscVerification ( TRANSACTION_ID , PSC_VERIFICATION_CREATED , headers ) ;
60+
61+ expect ( mockRequest . calledOnce ) . to . be . true ;
62+ expect ( mockRequest . firstCall . args [ 2 ] ) . to . deep . equal ( headers ) ;
63+ } ) ;
5464 } ) ;
5565
5666 describe ( "GET endpoint" , ( ) => {
@@ -92,6 +102,16 @@ describe("PSC Verification Link", () => {
92102 expect ( response . httpStatusCode ) . to . equal ( StatusCodes . INTERNAL_SERVER_ERROR ) ;
93103 expect ( response . errors ?. [ 0 ] ) . to . equal ( ReasonPhrases . INTERNAL_SERVER_ERROR ) ;
94104 } ) ;
105+
106+ it ( "uses provided headers" , async ( ) => {
107+ const mockRequest = sinon . stub ( requestClient , "httpGet" ) . resolves ( mockPscVerificationIndResponse [ 200 ] ) ;
108+
109+ const headers = { "X-Request-Id" : "random-uuid" } ;
110+ await pscService . getPscVerification ( TRANSACTION_ID , PSC_NOTIFICATION_ID , headers ) ;
111+
112+ expect ( mockRequest . calledOnce ) . to . be . true ;
113+ expect ( mockRequest . firstCall . args [ 1 ] ) . to . deep . equal ( headers ) ;
114+ } ) ;
95115 } ) ;
96116
97117 describe ( "PATCH endpoint" , ( ) => {
@@ -135,6 +155,17 @@ describe("PSC Verification Link", () => {
135155 expect ( response . httpStatusCode ) . to . equal ( StatusCodes . INTERNAL_SERVER_ERROR ) ;
136156 expect ( response . errors ?. [ 0 ] ) . to . equal ( ReasonPhrases . INTERNAL_SERVER_ERROR ) ;
137157 } ) ;
158+
159+ it ( "uses provided headers" , async ( ) => {
160+ const mockRequest = sinon . stub ( requestClient , "httpPatch" ) . resolves ( mockPscVerificationPatchIndResponse [ 200 ] ) ;
161+
162+ const testHeaders = { "X-Request-Id" : "random-uuid" } ;
163+ const existingHeaders = { "Content-Type" : "application/merge-patch+json" } ; // These are inserted by patchPscVerification
164+ await pscService . patchPscVerification ( TRANSACTION_ID , FILING_ID , PSC_VERIFICATION_IND , testHeaders ) ;
165+
166+ expect ( mockRequest . calledOnce ) . to . be . true ;
167+ expect ( mockRequest . firstCall . args [ 2 ] ) . to . deep . equal ( { ...existingHeaders , ...testHeaders } ) ;
168+ } ) ;
138169 } ) ;
139170
140171 describe ( "Validation status GET endpoint" , ( ) => {
@@ -192,6 +223,16 @@ describe("PSC Verification Link", () => {
192223 expect ( response . httpStatusCode ) . to . equal ( StatusCodes . INTERNAL_SERVER_ERROR ) ;
193224 expect ( response . errors ?. [ 0 ] ) . to . equal ( ReasonPhrases . INTERNAL_SERVER_ERROR ) ;
194225 } ) ;
226+
227+ it ( "uses provided headers" , async ( ) => {
228+ const mockRequest = sinon . stub ( requestClient , "httpGet" ) . resolves ( mockGetValidationStatusResponse [ 200 ] ) ;
229+
230+ const headers = { "X-Request-Id" : "random-uuid" } ;
231+ await pscService . getValidationStatus ( TRANSACTION_ID , PSC_NOTIFICATION_ID , headers ) ;
232+
233+ expect ( mockRequest . calledOnce ) . to . be . true ;
234+ expect ( mockRequest . firstCall . args [ 1 ] ) . to . deep . equal ( headers ) ;
235+ } ) ;
195236 } ) ;
196237
197238 describe ( "checkPlannedMaintenance endpoint" , ( ) => {
@@ -223,5 +264,15 @@ describe("PSC Verification Link", () => {
223264 expect ( response . httpStatusCode ) . to . equal ( StatusCodes . INTERNAL_SERVER_ERROR ) ;
224265 expect ( response . errors ?. [ 0 ] ) . to . equal ( ReasonPhrases . INTERNAL_SERVER_ERROR ) ;
225266 } ) ;
267+
268+ it ( "uses provided headers" , async ( ) => {
269+ const mockRequest = sinon . stub ( requestClient , "httpGet" ) . resolves ( mockPlannedMaintenanceResponse [ 200 ] ) ;
270+
271+ const headers = { "X-Request-Id" : "random-uuid" } ;
272+ await pscService . checkPlannedMaintenance ( headers ) ;
273+
274+ expect ( mockRequest . calledOnce ) . to . be . true ;
275+ expect ( mockRequest . firstCall . args [ 1 ] ) . to . deep . equal ( headers ) ;
276+ } ) ;
226277 } ) ;
227278} ) ;
0 commit comments