Hey :wave: Could anyone advice how to write match...
# pact-js
s
Hey 👋 Could anyone advice how to write matcher if I want to check keys and values and the same time (use
eachKeyMatches
and
eachValueMatches
simultaneously) I need something like
eachKeyValueMatches
but it doesn't exist Example
Copy code
enum Keys {
      One = "One",
      Two = "Two",
    }

    interface Value {
      min: number
      max: number
    }

    type R = Record<Keys, Value>
    const record: R  = {
      [Keys.One]:
        {
          min: 1,
          max: 2
        }
    }

  it("check record", async () => {
    messagePact
      .expectsToReceive("record")
      .withContent({
        // What need to write here to check type R ?
      })

  })
m
I don't think you can nest matchers like that. @rholshausen is it possible to compose them over FFI and I just need to improve the SSL to allow that?
r
You can use multiple matchers for the same element, they get combined using an AND.
m
How would I pass that through via the FFI (using https://docs.pact.io/implementation_guides/rust/pact_ffi/integrationjson as a guide)
r
Doesn't look like that supports it, only the matching definition expressions for now
There are two options, update the FFI to allow multiple matching rules and update the FFI to support the matching definition expressions
m
ta. i’ll create a feature request