Skip to content

Commit

Permalink
Now removes deprecation warning properly
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljbruce committed Jan 27, 2023
1 parent 8ab6b80 commit db02a50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ class Query {
this.filters.push(propertyOrFilter);
return this;
} else {
process.emitWarning(
'Providing Filter objects is recommended when using .filter'
);
let operator = operatorOrValue as Operator;
if (arguments.length === 2) {
value = operatorOrValue as {};
Expand Down
6 changes: 4 additions & 2 deletions test/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,12 @@ describe('entity', () => {
"' property is outside of bounds of a JavaScript Number.\n" +
"Use 'Datastore.int(<integer_value_as_string>)' to preserve accuracy during the upload.";

process.on('warning', warning => {
const onWarning = (warning: {message: unknown}) => {
assert.strictEqual(warning.message, expectedWarning);
process.removeListener('warning', onWarning);
done();
});
};
process.on('warning', onWarning);
entity.encodeValue(largeIntValue, property);
});

Expand Down

0 comments on commit db02a50

Please sign in to comment.