-
Notifications
You must be signed in to change notification settings - Fork 41
chore: add integration tests for count #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
const testCases = [ | ||
{ filter: undefined, expectedCount: 3 }, | ||
{ filter: {}, expectedCount: 3 }, | ||
{ filter: { age: { $lt: 15 } }, expectedCount: 2 }, | ||
{ filter: { age: { $gt: 5 }, name: { $regex: "^P" } }, expectedCount: 1 }, | ||
]; | ||
for (const testCase of testCases) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const testCases = [ | |
{ filter: undefined, expectedCount: 3 }, | |
{ filter: {}, expectedCount: 3 }, | |
{ filter: { age: { $lt: 15 } }, expectedCount: 2 }, | |
{ filter: { age: { $gt: 5 }, name: { $regex: "^P" } }, expectedCount: 1 }, | |
]; | |
for (const testCase of testCases) { | |
for (const testCase of [ | |
{ filter: undefined, expectedCount: 3 }, | |
{ filter: {}, expectedCount: 3 }, | |
{ filter: { age: { $lt: 15 } }, expectedCount: 2 }, | |
{ filter: { age: { $gt: 5 }, name: { $regex: "^P" } }, expectedCount: 1 }, | |
]) { |
nit: I think this is quicker to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially had it like that, but then moved it out because I thought it's getting cluttered with the test case definition inlined into the for loop.
const args = [ | ||
{}, | ||
{ database: 123, collection: "bar" }, | ||
{ foo: "bar", database: "test", collection: "bar" }, | ||
{ collection: [], database: "test" }, | ||
{ collection: "bar", database: "test", query: "{ $gt: { foo: 5 } }" }, | ||
]; | ||
for (const arg of args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const args = [ | |
{}, | |
{ database: 123, collection: "bar" }, | |
{ foo: "bar", database: "test", collection: "bar" }, | |
{ collection: [], database: "test" }, | |
{ collection: "bar", database: "test", query: "{ $gt: { foo: 5 } }" }, | |
]; | |
for (const arg of args) { | |
for (const arg of [ | |
{}, | |
{ database: 123, collection: "bar" }, | |
{ foo: "bar", database: "test", collection: "bar" }, | |
{ collection: [], database: "test" }, | |
{ collection: "bar", database: "test", query: "{ $gt: { foo: 5 } }" }, | |
]) { |
No description provided.