17 lines
707 B
TypeScript
17 lines
707 B
TypeScript
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' }}, publicTest: 'hi' };
|
|
|
|
smartexpect.expect(testObject).object.toHaveProperty('publicTest');
|
|
// Existence check
|
|
smartexpect.expect(testObject).object.toHaveProperty('level1.level2.level3');
|
|
// Value check
|
|
smartexpect.expect(testObject).object.toHaveProperty('level1.level2.level3', 'value');
|
|
// Negation for missing deep property
|
|
smartexpect.expect(testObject).not.object.toHaveProperty('level1.level2.missing');
|
|
});
|
|
|
|
export default tap.start();
|