Skip to content

Commit db3b2f1

Browse files
add array containing matcher
1 parent c260c4f commit db3b2f1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/src/matchers.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ class PactMatchers {
5656
};
5757
}
5858

59+
/// Allows heterogenous items to be matched within a list.
60+
/// Unlike EachLike which must be an array with elements of the same shape,
61+
/// ArrayContaining allows objects of different types and shapes.
62+
static Map ArrayContaining(List variants) {
63+
return {
64+
'pact:matcher:type': 'arrayContains',
65+
'variants': variants,
66+
};
67+
}
68+
5969
/// Matches a "Integer" (int) value, for example, 1.
6070
static Map IntegerLike(int example) {
6171
return {

0 commit comments

Comments
 (0)