()
| 245 | } |
| 246 | |
| 247 | export async function seedExam(): Promise<void> { |
| 248 | const query = { where: { id: examJson.id } }; |
| 249 | const testExamExists = |
| 250 | await fastifyTestInstance.prisma.exam.findUnique(query); |
| 251 | |
| 252 | if (testExamExists) { |
| 253 | await fastifyTestInstance.prisma.exam.deleteMany(query); |
| 254 | } |
| 255 | |
| 256 | await fastifyTestInstance.prisma.exam.create({ |
| 257 | data: { |
| 258 | ...examJson |
| 259 | } |
| 260 | }); |
| 261 | } |
| 262 | |
| 263 | export function createFetchMock({ ok = true, body = {} } = {}) { |
| 264 | return vi.fn().mockResolvedValue( |