From 794c62d432e07f631fa30cb6611575907b7d06c9 Mon Sep 17 00:00:00 2001 From: "Fawzi E. Abdulfattah" Date: Sun, 28 Nov 2021 13:35:03 +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..e240efa40e8e 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']);