Skip to content

Commit

Permalink
disconnect prisma client at end of each test
Browse files Browse the repository at this point in the history
  • Loading branch information
electrovir committed Sep 12, 2024
1 parent 76a027c commit 4512a96
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/node/src/prisma/model-data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ describe(

await prisma.client.addData(prismaClient, data);

return await prisma.client.dumpData(prismaClient, {
const dumpedData = await prisma.client.dumpData(prismaClient, {
omitFields: [
'createdAt',
'updatedAt',
'id',
],
});
await prismaClient.$disconnect();

return dumpedData;
}

it('includes all fields by default', async () => {
Expand Down Expand Up @@ -75,14 +78,18 @@ describe(
'role',
'updatedAt',
]);
await prismaClient.$disconnect();
});

it('dumps without limit', async () => {
const prismaClient = await setupPrismaClient();
assert.isDefined(
await prisma.client.dumpData(await setupPrismaClient(), {
await prisma.client.dumpData(prismaClient, {
limit: 0,
}),
);

await prismaClient.$disconnect();
});

it('adds without id', async () => {
Expand Down Expand Up @@ -139,6 +146,8 @@ describe(
).id,
'fake-id-2',
);

await prismaClient.$disconnect();
});

itCases(testData, [
Expand Down Expand Up @@ -193,7 +202,6 @@ describe(
},
},
},

expect: {
region: [
{regionName: 'fake'},
Expand Down Expand Up @@ -231,7 +239,6 @@ describe(
{regionName: 'fake'},
],
},

expect: {
region: [
{regionName: 'fake'},
Expand Down Expand Up @@ -283,5 +290,7 @@ describe(getAllPrismaModelNames.name, () => {
'userSettings',
'userStats',
]);

await prismaClient.$disconnect();
});
});

0 comments on commit 4512a96

Please sign in to comment.