Chore: Remove whereAndSelect and fix typescript of main PrismaClient adapter (#966)

This commit is contained in:
Alex van Andel authored and GitHub committed 2021-10-15 19:31:57 +01:00
1 parent 78182db99c
commit c01004b470
2 files changed
+10 -129

No files matched your search

-92
View File
@@ -1,92 +0,0 @@
import { expect, it } from "@jest/globals";
import { whereAndSelect } from "@lib/prisma";
it("can decorate using whereAndSelect", async () => {
whereAndSelect(
(queryObj) => {
expect(queryObj).toStrictEqual({ where: { id: 1 }, select: { example: true } });
},
{ id: 1 },
["example"]
);
});
it("can do nested selects using . seperator", async () => {
whereAndSelect(
(queryObj) => {
expect(queryObj).toStrictEqual({
where: {
uid: 1,
},
select: {
description: true,
attendees: {
select: {
email: true,
name: true,
},
},
},
});
},
{ uid: 1 },
["description", "attendees.email", "attendees.name"]
);
});
it("can handle nesting deeply", async () => {
whereAndSelect(
(queryObj) => {
expect(queryObj).toStrictEqual({
where: {
uid: 1,
},
select: {
description: true,
attendees: {
select: {
email: {
select: {
nested: true,
},
},
name: true,
},
},
},
});
},
{ uid: 1 },
["description", "attendees.email.nested", "attendees.name"]
);
});
it("can handle nesting multiple", async () => {
whereAndSelect(
(queryObj) => {
expect(queryObj).toStrictEqual({
where: {
uid: 1,
},
select: {
description: true,
attendees: {
select: {
email: true,
name: true,
},
},
bookings: {
select: {
id: true,
name: true,
},
},
},
});
},
{ uid: 1 },
["description", "attendees.email", "attendees.name", "bookings.id", "bookings.name"]
);
});