GitHub
03/18/2023, 2:43 PMv16.19.0
Issue Checklist
Please confirm the following:
☑︎ I have upgraded to the latest
☑︎ I have the read the FAQs in the Readme
☑︎ I have triple checked, that there are no unhandled promises in my code and have read the section on intermittent test failures
☑︎ I have set my log level to debug and attached a log file showing the complete request/response cycle
☐ For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem
Expected behaviour
We use MatchersV3.date and MatchersV3.time. The docs state:
String value that must match the provided date/time format string. [...] If the example value is omitted, a value will be generated using a Date/Time generator and the current system date/time.The expected behavior is that the provider will receive the passed example value of `101112`:
const x = MatchersV3.time("HH:mm:ss", "10:11:12")
Actual behaviour
The provider receives a generated date/time value, despite examples being given.
The Pact JSON file also contains generators for such date or time matchers.
Seems to be related to #620 which fixed it for MatchersV3.datetime.
While researching this I came across this document which seems to indicate that date/time values on the provider side could be dynamically generated. How can such expressions be included when generated values are used (i.e. no concrete examples are given, but a recipe describing the values to be generated). It would be very useful to use because "the current date/time" is not enough for most of our use-cases.
Steps to reproduce
const d = Matchers.date("yyyy-MM-dd", "2023-02-01");
expect(d["pact:generator:type"]).toBeUndefined();
const t = Matchers.time("HH:mm:ss", "10:11:12");
expect(t["pact:generator:type"]).toBeUndefined();
pact-foundation/pact-js