Skip to content

Commit 8df7009

Browse files
committed
Collection: add type-level tests for findOneAndReplace
1 parent dd4f601 commit 8df7009

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

packages/effect-mongodb/dtslint/Collection.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,27 @@ Collection.replaceOne(collection, { birthday: "2024-11-28" }, myType)
6363

6464
// $ExpectType Effect<Document | UpdateResult<Document>, MongoError | ParseError, never>
6565
F.pipe(collection, Collection.replaceOne({ birthday: "2024-11-28" }, myType))
66+
67+
// $ExpectType Effect<ModifyResult<{ readonly birthday: Date; }>, MongoError | ParseError, never>
68+
Collection.findOneAndReplace(collection, { birthday: "2024-11-28" }, myType, { includeResultMetadata: true })
69+
70+
// $ExpectType Effect<ModifyResult<{ readonly birthday: Date; }>, MongoError | ParseError, never>
71+
F.pipe(collection, Collection.findOneAndReplace({ birthday: "2024-11-28" }, myType, { includeResultMetadata: true }))
72+
73+
// $ExpectType Effect<Option<{ readonly birthday: Date; }>, MongoError | ParseError, never>
74+
Collection.findOneAndReplace(collection, { birthday: "2024-11-28" }, myType, { includeResultMetadata: false })
75+
76+
// $ExpectType Effect<Option<{ readonly birthday: Date; }>, MongoError | ParseError, never>
77+
F.pipe(collection, Collection.findOneAndReplace({ birthday: "2024-11-28" }, myType, { includeResultMetadata: false }))
78+
79+
// $ExpectType Effect<Option<{ readonly birthday: Date; }>, MongoError | ParseError, never>
80+
Collection.findOneAndReplace(collection, { birthday: "2024-11-28" }, myType, { comment: "any" })
81+
82+
// $ExpectType Effect<Option<{ readonly birthday: Date; }>, MongoError | ParseError, never>
83+
F.pipe(collection, Collection.findOneAndReplace({ birthday: "2024-11-28" }, myType, { comment: "any" }))
84+
85+
// $ExpectType Effect<Option<{ readonly birthday: Date; }>, MongoError | ParseError, never>
86+
Collection.findOneAndReplace(collection, { birthday: "2024-11-28" }, myType)
87+
88+
// $ExpectType Effect<Option<{ readonly birthday: Date; }>, MongoError | ParseError, never>
89+
F.pipe(collection, Collection.findOneAndReplace({ birthday: "2024-11-28" }, myType))

0 commit comments

Comments
 (0)