Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AsPulse committed Jun 8, 2023
1 parent 3596b0d commit 11b4489
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/cases/03_curd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,25 @@ testWithTestDBClient("testInsertMany", async (db) => {
assertEquals(insertedIds.length, 2);
});

testWithTestDBClient("testFindAndModify-notfound", async (db) => {
const users = db.collection<{ username: string; counter: number }>(
"mongo_test_users",
);

const find = await users.findAndModify(
{
// this query matches no document
$and: [{ username: "a" }, { username: "b" }],
},
{
new: false,
},
);

assert(find === null);
assert(find !== undefined);
});

testWithTestDBClient("testFindAndModify-update", async (db) => {
const users = db.collection<{ username: string; counter: number }>(
"mongo_test_users",
Expand Down

0 comments on commit 11b4489

Please sign in to comment.