| | import { PrismaClient } from '@prisma/client'; |
| | import * as dotenv from 'dotenv'; |
| |
|
| | dotenv.config(); |
| |
|
| | const prisma = new PrismaClient(); |
| |
|
| | async function smokeTest() { |
| | console.log('π§ͺ Starting smoke test...'); |
| |
|
| | try { |
| | |
| | const user = await prisma.user.findFirst(); |
| | if (!user) { |
| | throw new Error('User not found'); |
| | } |
| | console.log('β
User verified:', user.email); |
| |
|
| | |
| | const session = await prisma.session.findFirst(); |
| | if (!session) { |
| | throw new Error('Session not found'); |
| | } |
| | console.log('β
Session verified'); |
| |
|
| | |
| | const conversation = await prisma.conversation.findFirst({ |
| | include: { messages: true } |
| | }); |
| | if (!conversation || !conversation.messages.length) { |
| | throw new Error('Conversation or messages not found'); |
| | } |
| | console.log('β
Conversation and messages verified'); |
| |
|
| | |
| | const suggestion = await prisma.suggestion.findFirst(); |
| | if (!suggestion) { |
| | throw new Error('Suggestion not found'); |
| | } |
| | console.log('β
Suggestion verified'); |
| |
|
| | console.log('β
All smoke tests passed!'); |
| | } catch (error) { |
| | console.error('β Smoke test failed:', error); |
| | process.exit(1); |
| | } finally { |
| | await prisma.$disconnect(); |
| | } |
| | } |
| |
|
| | smokeTest(); |