@@ -179,7 +179,7 @@ describe('GenericApiHttpTransport', () => {
179179 const params = makeStub ( 'params' , {
180180 apiName,
181181 dataPath,
182- ripcordPath,
182+ ripcordPath : undefined ,
183183 ripcordDisabledValue : 'false' ,
184184 providerIndicatedTimePath : undefined ,
185185 } )
@@ -199,8 +199,6 @@ describe('GenericApiHttpTransport', () => {
199199 const expectedResponse = {
200200 data : {
201201 result : expectedValue ,
202- ripcord : false ,
203- ripcordAsInt : 0 ,
204202 } ,
205203 result : expectedValue ,
206204 timestamps : {
@@ -333,7 +331,7 @@ describe('GenericApiHttpTransport', () => {
333331 const params = makeStub ( 'params' , {
334332 apiName,
335333 dataPath,
336- ripcordPath,
334+ ripcordPath : undefined ,
337335 ripcordDisabledValue : 'false' ,
338336 providerIndicatedTimePath : undefined ,
339337 } )
@@ -353,8 +351,6 @@ describe('GenericApiHttpTransport', () => {
353351 const expectedResponse = {
354352 data : {
355353 result : expectedValue ,
356- ripcord : false ,
357- ripcordAsInt : 0 ,
358354 } ,
359355 result : expectedValue ,
360356 timestamps : {
@@ -380,7 +376,7 @@ describe('GenericApiHttpTransport', () => {
380376 const params = makeStub ( 'params' , {
381377 apiName,
382378 dataPath,
383- ripcordPath,
379+ ripcordPath : undefined ,
384380 ripcordDisabledValue : 'false' ,
385381 providerIndicatedTimePath : undefined ,
386382 } )
@@ -736,6 +732,44 @@ describe('GenericApiHttpTransport', () => {
736732 } )
737733 } )
738734
735+ it ( 'should treat missing ripcord as success with undefined disabledValue' , async ( ) => {
736+ process . env . TEST_API_URL = apiUrl
737+
738+ const params = {
739+ apiName,
740+ dataPath : 'net_asset_value' ,
741+ ripcordPath : 'ripcord' ,
742+ ripcordDisabledValue : 'undefined' ,
743+ }
744+
745+ const response = {
746+ response : {
747+ data : {
748+ net_asset_value : 1.004373 ,
749+ } ,
750+ cost : undefined ,
751+ } ,
752+ timestamps : { } ,
753+ }
754+
755+ const expectedResponse = {
756+ data : {
757+ result : '1.004373' ,
758+ ripcord : false ,
759+ ripcordAsInt : 0 ,
760+ } ,
761+ result : '1.004373' ,
762+ timestamps : { providerIndicatedTimeUnixMs : undefined } ,
763+ }
764+
765+ await doTransportTest ( {
766+ params,
767+ expectedRequestConfig : requestConfigWithoutAuthHeader ,
768+ response,
769+ expectedResponse,
770+ } )
771+ } )
772+
739773 it ( 'should not include ripcord status when ripcord path is absent' , async ( ) => {
740774 process . env . TEST_API_URL = apiUrl
741775
@@ -771,4 +805,40 @@ describe('GenericApiHttpTransport', () => {
771805 expectedResponse,
772806 } )
773807 } )
808+
809+ it ( 'should treat ripcord as enabled if ripcord field is expected but missing' , async ( ) => {
810+ process . env . TEST_API_URL = apiUrl
811+
812+ const params = {
813+ apiName,
814+ dataPath : 'net_asset_value' ,
815+ ripcordPath,
816+ ripcordDisabledValue : 'false' ,
817+ }
818+
819+ const response = {
820+ response : {
821+ data : {
822+ net_asset_value : 1.004373 ,
823+ } ,
824+ cost : undefined ,
825+ } ,
826+ timestamps : { } ,
827+ }
828+
829+ const expectedResponse = {
830+ errorMessage : `Ripcord activated for 'test'` ,
831+ ripcord : true ,
832+ ripcordAsInt : 1 ,
833+ statusCode : 503 ,
834+ timestamps : { } ,
835+ }
836+
837+ await doTransportTest ( {
838+ params,
839+ expectedRequestConfig : requestConfigWithoutAuthHeader ,
840+ response,
841+ expectedResponse,
842+ } )
843+ } )
774844} )
0 commit comments