Ardiel
02/09/2022, 7:29 AM"today +1 day @ 6 o'clock pm"
If it is possible to use this kind of expression, could you, please, give us some examples of its usage?
Thanks a lot!Matt (pactflow.io / pact-js / pact-go)
Marko (IttyBittyApps / pact-swift)
02/13/2022, 3:27 AMPactSwift
passes the expression
into the DateTime example generator. But pact-rust
only spits out the type
and format
- just like the spec v3 says.
The way I can see this making sense is to have the āexpressionā (or really just a provided Date
object) used for the consumer tests. But goes against best practices where Pact would be used to test values instead of validating structure and types.Marko (IttyBittyApps / pact-swift)
02/13/2022, 3:29 AMString
using the provided format for the consumer test. Instead of the existing ExampleGenerator.RandomDateTime(format: String)
that returns a formatted date for consumer tests.
But I donāt think thereās a declarative way of defining Date
objects though in Swift where you could just say āsome day in the future added by 3 hours and 4 millisecondsā. Youāll need to use Calendar
and create the Date
object by adding date components.Marko (IttyBittyApps / pact-swift)
02/13/2022, 3:37 AM{
"startDate": "some words describing a date" // instead of exemplary "2023-02-13"
}
so then I canāt use Decodable
on to convert into Date
objectā¦ š
Marko (IttyBittyApps / pact-swift)
02/14/2022, 10:52 PMMarko (IttyBittyApps / pact-swift)
03/05/2022, 10:11 PMfeature/generator/datetime-expression
(link: https://github.com/surpher/PactSwift/tree/feature/generator/datetime-expression)
Have it a spin and let me know if it works as expected. If it does Iāll release a new version.Marko (IttyBittyApps / pact-swift)
03/05/2022, 10:13 PM.willRespondWith(
status: 201,
body: [
"start": ExampleGenerator.DateTimeExpression(expression: "@ next hour", format: dateFormat)
]
)
Marko (IttyBittyApps / pact-swift)
03/05/2022, 10:47 PMMarcelino
03/07/2022, 8:00 AMMarko (IttyBittyApps / pact-swift)
03/08/2022, 2:00 AMMarcelino
03/08/2022, 10:46 AMMarko (IttyBittyApps / pact-swift)
03/09/2022, 10:35 PMDateTimeExpression
now available in PactSwift v0.12.0
Marcelino
03/10/2022, 11:43 AMMarko (IttyBittyApps / pact-swift)
03/10/2022, 12:45 PM