Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lindomar reitz add support to match integers and floats #108

Merged
merged 8 commits into from
Nov 28, 2024

Conversation

YOU54F
Copy link
Member

@YOU54F YOU54F commented Aug 14, 2024

continuation of #38

fixes #13 by utilising regex string from pact-jvm

notes from previous PR

  • on consumer side, pact.term allowed int and float(decimal) value, with the value changed to a string (which is stored in the pact file)
  • on the provider side, int and float(decimal) values returned from the consumer, were not transformed into strings for comparison against the specified term regex.

This updated change will allow int/float(decimal) values to be changed to string at the point of comparison against the regex, both during consumer and provider tests.

On the provider side, if the value is a float or string, the error message returned returns the object type in the message.

With regard to existing behaviour, it may also be noted that using Pact.like(1) or Pact.like(50.51) will serialising the correct value to the contract (int or float) however the provider test would pass with a type match, when the provider returns 50 and the consumer set Pact.like(50.51).

Integer

Term.new(generate: 10, matcher: /[0-9]/

Float / Decimal

Term.new(generate: 50.51, matcher: /\d(\.\d{1,2})/)

@YOU54F YOU54F merged commit df97a7d into master Nov 28, 2024
31 checks passed
YOU54F added a commit that referenced this pull request Nov 28, 2024
…d-support-to-match-integers-and-floats"

This reverts commit df97a7d, reversing
changes made to 4ae667f.
@YOU54F YOU54F deleted the LindomarReitz-add-support-to-match-integers-and-floats branch November 29, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for "decimal" matcher for v2 matching
2 participants