diff --git a/src/messageConsumerPact.ts b/src/messageConsumerPact.ts index 7ef9cf2c1..0f3efad3f 100644 --- a/src/messageConsumerPact.ts +++ b/src/messageConsumerPact.ts @@ -74,9 +74,7 @@ export class MessageConsumerPact { if (typeof state === 'string') { this.message.given(state); } else { - forEachObjIndexed((v, k) => { - this.message.givenWithParam(state.name, `${k}`, JSON.stringify(v)); - }, state.params); + this.message.givenWithParams(state.name, JSON.stringify(state.params)); } return this; diff --git a/src/v3/pact.ts b/src/v3/pact.ts index 9cdb9a23c..5956f468d 100644 --- a/src/v3/pact.ts +++ b/src/v3/pact.ts @@ -1,4 +1,4 @@ -import { forEachObjIndexed, equals } from 'ramda'; +import { equals } from 'ramda'; import { makeConsumerPact, ConsumerPact, @@ -97,13 +97,10 @@ export class PactV3 { this.interaction = this.pact.newInteraction(description); this.states.forEach((s) => { if (s.parameters) { - forEachObjIndexed((v, k) => { - this.interaction.givenWithParam( - s.description, - `${k}`, - JSON.stringify(v) - ); - }, s.parameters); + this.interaction.givenWithParams( + s.description, + JSON.stringify(s.parameters) + ); } else { this.interaction.given(s.description); } diff --git a/src/v4/http/index.ts b/src/v4/http/index.ts index ccee60a0b..f62508015 100644 --- a/src/v4/http/index.ts +++ b/src/v4/http/index.ts @@ -53,9 +53,7 @@ export class UnconfiguredInteraction implements V4UnconfiguredInteraction { given(state: string, parameters?: JsonMap): V4UnconfiguredInteraction { if (parameters) { - forEachObjIndexed((v, k) => { - this.interaction.givenWithParam(state, `${k}`, JSON.stringify(v)); - }, parameters); + this.interaction.givenWithParams(state, JSON.stringify(parameters)); } else { this.interaction.given(state); } diff --git a/src/v4/message/index.ts b/src/v4/message/index.ts index 6ffbcc712..6d5666dca 100644 --- a/src/v4/message/index.ts +++ b/src/v4/message/index.ts @@ -43,9 +43,7 @@ export class UnconfiguredSynchronousMessage given(state: string, parameters?: JsonMap): V4UnconfiguredSynchronousMessage { if (parameters) { - forEachObjIndexed((v, k) => { - this.interaction.givenWithParam(state, `${k}`, JSON.stringify(v)); - }, parameters); + this.interaction.givenWithParams(state, JSON.stringify(parameters)); } else { this.interaction.given(state); }