Remove --experimental-vm-modules & fix Codacy
parent
e08815ce78
commit
de74d85fac
|
@ -4,7 +4,7 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"test": "node --experimental-vm-modules node_modules/.bin/jest",
|
"test": "node node_modules/.bin/jest",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"postinstall": "prisma generate",
|
"postinstall": "prisma generate",
|
||||||
|
|
|
@ -1,20 +1,23 @@
|
||||||
|
|
||||||
import {it, expect} from '@jest/globals';
|
import { it, expect } from '@jest/globals';
|
||||||
import {whereAndSelect} from "@lib/prisma";
|
import { whereAndSelect } from "@lib/prisma";
|
||||||
|
|
||||||
it('can decorate using whereAndSelect', async () => {
|
it("can decorate using whereAndSelect", async () => {
|
||||||
whereAndSelect( (queryObj) => {
|
whereAndSelect(
|
||||||
|
(queryObj) => {
|
||||||
expect(queryObj).toStrictEqual({ where: { id: 1 }, select: { example: true } });
|
expect(queryObj).toStrictEqual({ where: { id: 1 }, select: { example: true } });
|
||||||
},
|
},
|
||||||
{ id: 1 },
|
{ id: 1 },
|
||||||
[
|
[
|
||||||
"example"
|
"example",
|
||||||
])
|
]
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can do nested selects using . seperator', async () => {
|
it("can do nested selects using . seperator", async () => {
|
||||||
|
|
||||||
whereAndSelect( (queryObj) => {
|
whereAndSelect(
|
||||||
|
(queryObj) => {
|
||||||
expect(queryObj).toStrictEqual({
|
expect(queryObj).toStrictEqual({
|
||||||
where: {
|
where: {
|
||||||
uid: 1,
|
uid: 1,
|
||||||
|
@ -27,7 +30,7 @@ it('can do nested selects using . seperator', async () => {
|
||||||
name: true,
|
name: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
{ uid: 1 },
|
{ uid: 1 },
|
||||||
|
@ -35,11 +38,13 @@ it('can do nested selects using . seperator', async () => {
|
||||||
"description",
|
"description",
|
||||||
"attendees.email",
|
"attendees.email",
|
||||||
"attendees.name",
|
"attendees.name",
|
||||||
])
|
]
|
||||||
})
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('can handle nesting deeply', async () => {
|
it("can handle nesting deeply", async () => {
|
||||||
whereAndSelect( (queryObj) => {
|
whereAndSelect(
|
||||||
|
(queryObj) => {
|
||||||
expect(queryObj).toStrictEqual({
|
expect(queryObj).toStrictEqual({
|
||||||
where: {
|
where: {
|
||||||
uid: 1,
|
uid: 1,
|
||||||
|
@ -50,13 +55,13 @@ it('can handle nesting deeply', async () => {
|
||||||
select: {
|
select: {
|
||||||
email: {
|
email: {
|
||||||
select: {
|
select: {
|
||||||
nested: true
|
nested: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
name: true,
|
name: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
{ uid: 1 },
|
{ uid: 1 },
|
||||||
|
@ -64,11 +69,13 @@ it('can handle nesting deeply', async () => {
|
||||||
"description",
|
"description",
|
||||||
"attendees.email.nested",
|
"attendees.email.nested",
|
||||||
"attendees.name",
|
"attendees.name",
|
||||||
])
|
]
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can handle nesting multiple', async () => {
|
it("can handle nesting multiple", async () => {
|
||||||
whereAndSelect( (queryObj) => {
|
whereAndSelect(
|
||||||
|
(queryObj) => {
|
||||||
expect(queryObj).toStrictEqual({
|
expect(queryObj).toStrictEqual({
|
||||||
where: {
|
where: {
|
||||||
uid: 1,
|
uid: 1,
|
||||||
|
@ -97,5 +104,6 @@ it('can handle nesting multiple', async () => {
|
||||||
"attendees.name",
|
"attendees.name",
|
||||||
"bookings.id",
|
"bookings.id",
|
||||||
"bookings.name",
|
"bookings.name",
|
||||||
])
|
]
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue