Remove --experimental-vm-modules & fix Codacy

This commit is contained in:
Alex van Andel 2021-07-06 18:23:33 +00:00
parent e08815ce78
commit de74d85fac
2 changed files with 29 additions and 21 deletions

View File

@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"test": "node --experimental-vm-modules node_modules/.bin/jest",
"test": "node node_modules/.bin/jest",
"build": "next build",
"start": "next start",
"postinstall": "prisma generate",

View File

@ -1,20 +1,23 @@
import {it, expect} from '@jest/globals';
import {whereAndSelect} from "@lib/prisma";
import { it, expect } 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 } });
it("can decorate using whereAndSelect", async () => {
whereAndSelect(
(queryObj) => {
expect(queryObj).toStrictEqual({ where: { id: 1 }, select: { example: true } });
},
{ 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({
where: {
uid: 1,
@ -27,7 +30,7 @@ it('can do nested selects using . seperator', async () => {
name: true,
},
},
}
},
});
},
{ uid: 1 },
@ -35,11 +38,13 @@ it('can do nested selects using . seperator', async () => {
"description",
"attendees.email",
"attendees.name",
])
})
]
);
});
it('can handle nesting deeply', async () => {
whereAndSelect( (queryObj) => {
it("can handle nesting deeply", async () => {
whereAndSelect(
(queryObj) => {
expect(queryObj).toStrictEqual({
where: {
uid: 1,
@ -50,13 +55,13 @@ it('can handle nesting deeply', async () => {
select: {
email: {
select: {
nested: true
nested: true,
}
},
name: true,
},
},
}
},
});
},
{ uid: 1 },
@ -64,11 +69,13 @@ it('can handle nesting deeply', async () => {
"description",
"attendees.email.nested",
"attendees.name",
])
]
);
});
it('can handle nesting multiple', async () => {
whereAndSelect( (queryObj) => {
it("can handle nesting multiple", async () => {
whereAndSelect(
(queryObj) => {
expect(queryObj).toStrictEqual({
where: {
uid: 1,
@ -97,5 +104,6 @@ it('can handle nesting multiple', async () => {
"attendees.name",
"bookings.id",
"bookings.name",
])
]
);
});