feat(core): Add new matchers and improve negation messaging
This commit is contained in:
22
test/test.negation.ts
Normal file
22
test/test.negation.ts
Normal 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();
|
Reference in New Issue
Block a user