From e3515c3de43422c067db0533ed88e0b58fb88159 Mon Sep 17 00:00:00 2001 From: "Fawzi E. Abdulfattah" Date: Sun, 28 Nov 2021 13:31:47 +0200 Subject: [PATCH] Updating the docs to show array selection with toHaveProperty Matcher --- docs/ExpectAPI.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/ExpectAPI.md b/docs/ExpectAPI.md index eddf1bec562e..be55bd43984d 100644 --- a/docs/ExpectAPI.md +++ b/docs/ExpectAPI.md @@ -895,6 +895,16 @@ const houseForSale = { wallColor: 'white', 'nice.oven': true, }, + livingroom: { + amenities: [ + { + 'couch': [ + ['large', { dimensions: [20,20] }], + ['small', { dimensions: [10,10] }], + ] + }, + ] + }, 'ceiling.height': 2, }; @@ -922,6 +932,7 @@ test('this house has my desired features', () => { ['oven', 'stove', 'washer'], ); expect(houseForSale).toHaveProperty(['kitchen', 'amenities', 0], 'oven'); + expect(houseForSale).toHaveProperty(['livingroom.amenities[0].couch[0][1].dimensions[0]'], '20'); expect(houseForSale).toHaveProperty(['kitchen', 'nice.oven']); expect(houseForSale).not.toHaveProperty(['kitchen', 'open']);