I'm trying to test APIKit in MUnit. Originally I was using an http request within MUnit to call my flow and then APIKit would route the request to the proper subflow where my logic lives. Now I want to mock one of the elements of the subflow, so I'm trying to replace the http request with a reference to the APIKit flow. This works, but the APIKit router throws an error:
Cannot resolve request base path
Because none of the inbound properties are set. And this is my problem, how do I mimic the inbound properties that I send to a flow reference so that the request looks like it came from an HTTP request? Alternatively, is there another way I can structure the code so that I can mock an element of my logic?
Thanks
You can add properties on your mock http response. See sample below:
<mock:when messageProcessor=".*:.*" doc:name="Queue Message">
<mock:with-attributes>
<mock:with-attribute name="doc:name" whereValue="#['Queue Message']"/>
</mock:with-attributes>
<mock:then-return payload="#['Sample response']">
<mock:inbound-properties>
<mock:inbound-property key="prop1" value="val1"/>
<mock:inbound-property key="prop2" value="val2"/>
</mock:inbound-properties>
</mock:then-return>
</mock:when>
Hope this helps