Skip to content

Commit

Permalink
Add a test for new warning
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljbruce committed Jan 27, 2023
1 parent db02a50 commit bc15f32
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,19 @@ describe('Query', () => {
assert.strictEqual(filter.op, '=');
assert.strictEqual(filter.val, 'Stephen');
});

it('should issue a warning when a Filter instance is not provided', done => {
const onWarning = (warning: {message: unknown}) => {
assert.strictEqual(
warning.message,
'Providing Filter objects is recommended when using .filter'
);
process.removeListener('warning', onWarning);
done();
};
process.on('warning', onWarning);
new Query(['kind1']).filter('name', 'Stephen');
});
});

describe('filter with Filter class', () => {
Expand Down

0 comments on commit bc15f32

Please sign in to comment.