feat(core): Add new matchers and improve negation messaging

This commit is contained in:
2025-04-28 20:42:58 +00:00
parent 1847838ac3
commit 9b488a87a0
13 changed files with 300 additions and 21 deletions

22
test/test.negation.ts Normal file
View File

@ -0,0 +1,22 @@
import { tap, expect as tExpect } from '@push.rocks/tapbundle';
import * as smartexpect from '../dist_ts/index.js';
tap.test('negation message for numeric matcher', async () => {
try {
smartexpect.expect(5).not.toBeGreaterThan(3);
throw new Error('Assertion did not throw');
} catch (err: any) {
tExpect(err.message).toEqual('Expected number not to be greater than 3');
}
});
tap.test('negation message for string matcher', async () => {
try {
smartexpect.expect('hello').not.string.toInclude('he');
throw new Error('Assertion did not throw');
} catch (err: any) {
tExpect(err.message).toEqual('Expected string not to include "he"');
}
});
export default tap.start();