ekino / veggies

:sparkles: :rocket: Veggies is an awesome cucumberjs library for API/CLI testing. Great for testing APIs built upon Express, Koa, HAPI, Loopback and others. It's also the perfect companion for testing CLI applications built with commander, meow & Co.
https://ekino.github.io/veggies/
MIT License
90 stars 18 forks source link

feat(assertions): expose function to assert date with formatting #41

Closed matthyy closed 4 years ago

matthyy commented 5 years ago

Goal

The purpose of this pull request is to be able to validate date field of an api response. Given a format, a locale and a offset to now, this value will be compared to a specific field.

Summary

With this pull request, one can target a field in an api response and be able to explicitly validate the field. You will find an example here below of the syntax.

| field    | matcher         | value                                 |
| dateA | equalRelativeDate | 2,days,dddd,fr                         |
| dateB | equalRelativeDate | -1,week,dddd,fr                       |
| dateC | equalRelativeDate | 4,hours,en,[Today] hh[h]mm |
plouc commented 5 years ago

@matthyy, documentation should be updated too, please note that you must edit README.tpl.md instead of README.md as step definitions are automatically injected.

plouc commented 5 years ago

@matthyy, since I've merged the support for more versatile snapshots, can you please rebase your PR?

Crow-EH commented 5 years ago

@matthyy it seems like Node 6 doesn't support Intl.getCanonicalLocales()

plouc commented 5 years ago

@Crow-EH since Node 6 is now in EOL, I think it's fine to remove it from the supported versions, as long as we add engines and enable engineStrict in package.json.

matthyy commented 5 years ago

@plouc hello raph, I have changed the spec for this new type of matcher. All data necessary to get a Date are set in the value field. Let me know what you think about it?

leguellec commented 4 years ago

Could you please rebase your branch, and you should have a look to #43 for assertions with negations