Skip to content

Commit 5f304e7

Browse files
anandgupta42claude
andcommitted
test(mongodb): expect the missing-collection error from read validation
Reads now validate the target collection and fail with the available collections instead of returning zero rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 096d913 commit 5f304e7

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎packages/opencode/test/altimate/drivers-mongodb-e2e.test.ts‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,15 +1976,16 @@ describe.skipIf(!DOCKER && !MONGODB_USE_CI)("MongoDB Driver E2E", () => {
19761976
).rejects.toThrow()
19771977
})
19781978

1979-
test("handles queries on non-existent collection (find returns empty)", async () => {
1980-
const result = await connector.execute(
1981-
cmd({
1982-
command: "find",
1983-
database: "testdb",
1984-
collection: "totally_nonexistent_collection_xyz",
1985-
}),
1986-
)
1987-
expect(result.row_count).toBe(0)
1979+
test("rejects queries on a non-existent collection and lists the available ones", async () => {
1980+
await expect(
1981+
connector.execute(
1982+
cmd({
1983+
command: "find",
1984+
database: "testdb",
1985+
collection: "totally_nonexistent_collection_xyz",
1986+
}),
1987+
),
1988+
).rejects.toThrow(/does not exist or is not accessible.*Available collections: .*users/)
19881989
})
19891990

19901991
test("handles numeric edge cases in documents", async () => {

0 commit comments

Comments
 (0)