Add objectId test

This commit is contained in:
Adria Navarro 2025-01-29 18:11:39 +01:00
parent 794acbb569
commit 52b504a607
1 changed files with 22 additions and 0 deletions

View File

@ -634,6 +634,28 @@ if (descriptions.length) {
}
})
})
it("should be able to select a ObjectId in a transformer", async () => {
const query = await createQuery({
fields: {
json: {},
extra: {
actionType: "find",
},
},
transformer: "return data.map(x => ({ id: x._id }))",
})
const result = await config.api.query.execute(query._id!)
expect(result.data).toEqual([
{ id: expectValidId },
{ id: expectValidId },
{ id: expectValidId },
{ id: expectValidId },
{ id: expectValidId },
])
})
})
it("should throw an error if the incorrect actionType is specified", async () => {