Fix tests
This commit is contained in:
16
server/src/database/client-mock/context.ts
Normal file
16
server/src/database/client-mock/context.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import { mockDeep, DeepMockProxy } from 'jest-mock-extended';
|
||||
|
||||
export type Context = {
|
||||
prisma: PrismaClient;
|
||||
};
|
||||
|
||||
export type MockContext = {
|
||||
prisma: DeepMockProxy<PrismaClient>;
|
||||
};
|
||||
|
||||
export const createMockContext = (): MockContext => {
|
||||
return {
|
||||
prisma: mockDeep<PrismaClient>(),
|
||||
};
|
||||
};
|
||||
@ -5,4 +5,4 @@ import { PrismaService } from './prisma.service';
|
||||
providers: [PrismaService],
|
||||
exports: [PrismaService],
|
||||
})
|
||||
export class PrismaModule {}
|
||||
export class PrismaModule {}
|
||||
|
||||
@ -12,4 +12,4 @@ export class PrismaService extends PrismaClient implements OnModuleInit {
|
||||
await app.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,22 +8,22 @@ datasource db {
|
||||
}
|
||||
|
||||
model WorkspaceMember {
|
||||
id Int @id @default(autoincrement())
|
||||
id Int @id @default(autoincrement())
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
deleted_at DateTime?
|
||||
user_id String @unique
|
||||
user_id String @unique
|
||||
workspace_id Int
|
||||
|
||||
@@map("workspace_members")
|
||||
}
|
||||
|
||||
model Workspace {
|
||||
id Int @id @default(autoincrement())
|
||||
id Int @id @default(autoincrement())
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
deleted_at DateTime?
|
||||
domain_name String @unique
|
||||
domain_name String @unique
|
||||
display_name String
|
||||
|
||||
@@map("workspaces")
|
||||
|
||||
Reference in New Issue
Block a user