Files
davinci-platform/packages/api/src/prisma/__tests__/prisma.service.spec.ts

34 lines
973 B
TypeScript
Raw Normal View History

import { Test, TestingModule } from '@nestjs/testing';
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { PrismaService } from '../prisma.service.js';
import { ConfigService } from '@nestjs/config';
describe('PrismaService', () => {
let service: PrismaService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [
PrismaService,
{
provide: ConfigService,
useValue: {
getOrThrow: vi.fn().mockReturnValue('postgresql://test:test@localhost:5432/test'),
},
},
],
}).compile();
service = module.get<PrismaService>(PrismaService);
});
it('should be defined', () => {
expect(service).toBeDefined();
});
it('should expose PrismaClient methods directly (extends pattern)', () => {
expect(typeof service.$connect).toBe('function');
expect(typeof service.$disconnect).toBe('function');
});
});