From 07711ad6a6627689a4c2e0d348d23c682f4070bc Mon Sep 17 00:00:00 2001 From: f-delahaye Date: Thu, 14 Mar 2024 22:09:00 +0100 Subject: [PATCH] #2515 --- .../intuit/karate/core/schema-like.feature | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/karate-core/src/test/java/com/intuit/karate/core/schema-like.feature b/karate-core/src/test/java/com/intuit/karate/core/schema-like.feature index dcee29166..087a50c1e 100644 --- a/karate-core/src/test/java/com/intuit/karate/core/schema-like.feature +++ b/karate-core/src/test/java/com/intuit/karate/core/schema-like.feature @@ -136,6 +136,27 @@ Then match response == * def partDeep = { a: [1] } * match actual contains deep part +# contains only deep +* def shuffledDeep = [{ a: [2, 1], b: 'x' }, { a: [4, 3], b: 'y' }] +* match actualDeep != shuffledDeep +* match actualDeep contains only deep shuffledDeep +# #2515 contains only shortcut (^^) is actually converted to contains only deep when applied to a list. + * def cat = + """ + { + name: 'Billie', + kittens: [ + { id: 23, name: 'Bob', bla: [{ b: '1'}] }, + { id: 42, name: 'Wild' } + ] + } + """ +* def expectedKittens = [{ id: 42, name: 'Wild' }, { id: 23, name: 'Bob', bla: [{ b: '1'}]}] +* match cat == { name: 'Billie', kittens: '#(^^expectedKittens)' } +# Bug actually spotted by 2515 ... Below test used to pass when it should not. This is a special case of contains-onlw-deep-does-not-match-item.feature +* def partExpectedKittens = [{ id: 42, name: 'Wild' }, { id: 23, name: 'Bob', bla: { b: '1'} }] +* match cat != { name: 'Billie', kittens: '#(^^partExpectedKittens)' } + Scenario: complex nested arrays * def json = """