Skip to content

feat(test):add tests for different date matcher scenarios in pact_ffi#489

Merged
rholshausen merged 1 commit into
pact-foundation:masterfrom
pulak777:pact-ffi-tests
Mar 16, 2025
Merged

feat(test):add tests for different date matcher scenarios in pact_ffi#489
rholshausen merged 1 commit into
pact-foundation:masterfrom
pulak777:pact-ffi-tests

Conversation

@pulak777

Copy link
Copy Markdown

Tests for different date matcher scenarios (applicable for datetime/time as well) -

  1. when pact:generator:type is provided in the body matcher, mock server returns current time (Local::now()) in the provided format
  2. when not provided, mock server returns the specified value

Context - Currently when using pact-js v3 matcher type date and time, mock-server returns current date/time while it's expected to return the example date/time. The issue is not originating from here (will create a seperate pr for that in pact-js), but these additional tests might worth having.

@rholshausen

Copy link
Copy Markdown
Contributor

There is a compile error with the tests:

error[E0433]: failed to resolve: use of undeclared type `Local`
    --> pact_ffi/tests/tests.rs:2216:24
     |
2216 |             let date = Local::now().format("%Y-%m-%d").to_string();
     |                        ^^^^^ use of undeclared type `Local`
     |
help: consider importing this struct
     |
1    + use chrono::Local;
     |

@pulak777

Copy link
Copy Markdown
Author

oops! must have removed the import while reverting lint changes

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.

2 participants