Skip to content

Commit e3515c3

Browse files
committed
Updating the docs to show array selection with toHaveProperty Matcher
1 parent 3ed1577 commit e3515c3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/ExpectAPI.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,16 @@ const houseForSale = {
895895
wallColor: 'white',
896896
'nice.oven': true,
897897
},
898+
livingroom: {
899+
amenities: [
900+
{
901+
'couch': [
902+
['large', { dimensions: [20,20] }],
903+
['small', { dimensions: [10,10] }],
904+
]
905+
},
906+
]
907+
},
898908
'ceiling.height': 2,
899909
};
900910

@@ -922,6 +932,7 @@ test('this house has my desired features', () => {
922932
['oven', 'stove', 'washer'],
923933
);
924934
expect(houseForSale).toHaveProperty(['kitchen', 'amenities', 0], 'oven');
935+
expect(houseForSale).toHaveProperty(['livingroom.amenities[0].couch[0][1].dimensions[0]'], '20');
925936
expect(houseForSale).toHaveProperty(['kitchen', 'nice.oven']);
926937
expect(houseForSale).not.toHaveProperty(['kitchen', 'open']);
927938

0 commit comments

Comments
 (0)