feat(object): add toHaveOwnProperty method and improve property-path matching in object assertions
This commit is contained in:
@ -2,7 +2,9 @@ import { tap, expect as tExpect } from '@push.rocks/tapbundle';
|
||||
import * as smartexpect from '../dist_ts/index.js';
|
||||
|
||||
tap.test('toHaveProperty nested path via dot notation', async () => {
|
||||
const testObject = { level1: { level2: { level3: 'value' } } };
|
||||
const testObject = { level1: { level2: { level3: 'value' }}, publicTest: 'hi' };
|
||||
|
||||
smartexpect.expect(testObject).object.toHaveProperty('publicTest');
|
||||
// Existence check
|
||||
smartexpect.expect(testObject).object.toHaveProperty('level1.level2.level3');
|
||||
// Value check
|
||||
@ -11,4 +13,4 @@ tap.test('toHaveProperty nested path via dot notation', async () => {
|
||||
smartexpect.expect(testObject).not.object.toHaveProperty('level1.level2.missing');
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
export default tap.start();
|
||||
|
Reference in New Issue
Block a user