Skip to content

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

Merged
merged 1 commit into from
Apr 16, 2025
Merged

Conversation

nirinchev
Copy link
Collaborator

No description provided.

@nirinchev nirinchev requested a review from gagik April 16, 2025 10:52
@coveralls
Copy link
Collaborator

Coverage Status

coverage: 50.98% (+0.4%) from 50.613%
when pulling 3eb7553 on ni/integration-count
into 939faad on main.

Comment on lines +99 to +105
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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Collaborator Author

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.

Comment on lines +41 to +48
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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 } }" },
]) {

@nirinchev nirinchev merged commit 4c92c52 into main Apr 16, 2025
5 checks passed
@nirinchev nirinchev deleted the ni/integration-count branch April 16, 2025 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants