mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 12:25:22 +00:00
50 lines
No EOL
1.3 KiB
TypeScript
50 lines
No EOL
1.3 KiB
TypeScript
import { SINGLE_TENANT_ORG_DOMAIN, SINGLE_TENANT_ORG_ID, SINGLE_TENANT_ORG_NAME } from '@/lib/constants';
|
|
import { ApiKey, Org, PrismaClient, User } from '@prisma/client';
|
|
import { beforeEach, vi } from 'vitest';
|
|
import { mockDeep, mockReset } from 'vitest-mock-extended';
|
|
|
|
beforeEach(() => {
|
|
mockReset(prisma);
|
|
});
|
|
|
|
export const prisma = mockDeep<PrismaClient>();
|
|
|
|
export const MOCK_ORG: Org = {
|
|
id: SINGLE_TENANT_ORG_ID,
|
|
name: SINGLE_TENANT_ORG_NAME,
|
|
domain: SINGLE_TENANT_ORG_DOMAIN,
|
|
createdAt: new Date(),
|
|
updatedAt: new Date(),
|
|
isOnboarded: true,
|
|
imageUrl: null,
|
|
metadata: null,
|
|
memberApprovalRequired: false,
|
|
stripeCustomerId: null,
|
|
stripeSubscriptionStatus: null,
|
|
stripeLastUpdatedAt: null,
|
|
inviteLinkEnabled: false,
|
|
inviteLinkId: null
|
|
}
|
|
|
|
export const MOCK_API_KEY: ApiKey = {
|
|
name: 'Test API Key',
|
|
hash: 'apikey',
|
|
createdAt: new Date(),
|
|
lastUsedAt: new Date(),
|
|
orgId: 1,
|
|
createdById: '1',
|
|
}
|
|
|
|
export const MOCK_USER: User = {
|
|
id: '1',
|
|
name: 'Test User',
|
|
email: 'test@test.com',
|
|
createdAt: new Date(),
|
|
updatedAt: new Date(),
|
|
hashedPassword: null,
|
|
emailVerified: null,
|
|
image: null,
|
|
permissionSyncedAt: null
|
|
}
|
|
|
|
export const userScopedPrismaClientExtension = vi.fn(); |