Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
hokaccha committed Mar 24, 2024
1 parent b0b508e commit 466ea8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,14 @@ import { prisma } from "./client";
import { createUser } from "./user";

describe("user", () => {
it("should be able to create a new user", async () => {
it("should create a new user", async () => {
// this record will delete by prisma-cleaner in afterEach defined by setup.ts
const created = await createUser("xxx");
expect(created.email).toEqual("xxx");
expect(await prisma.user.count()).toEqual(1);
});

it("should be cleanup user table", async () => {
it("should be cleanup user table by cleaner", async () => {
const count = await prisma.user.count();
expect(count).toEqual(0);
});
Expand Down
6 changes: 4 additions & 2 deletions example/with-jest/src/user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { prisma } from "./client";
import { createUser } from "./user";

describe("user", () => {
it("should be able to create a new user", async () => {
it("should create a new user", async () => {
// this record will delete by prisma-cleaner in afterEach defined by setup.ts
const created = await createUser("xxx");
expect(created.email).toEqual("xxx");
expect(await prisma.user.count()).toEqual(1);
});

it("should be cleanup user table", async () => {
it("should be cleanup user table by cleaner", async () => {
const count = await prisma.user.count();
expect(count).toEqual(0);
});
Expand Down

0 comments on commit 466ea8e

Please sign in to comment.