Skip to main content
Glama

Prisma MCP Server

Official
by prisma
Apache 2.0
4
44,231
  • Linux
  • Apple
tests.ts2.24 kB
import testMatrix from './_matrix' // @ts-ignore import type { PrismaClient } from './generated/prisma/client' declare let prisma: PrismaClient testMatrix.setupTestSuite(() => { const dateInput1 = '2011-01-01T00:00:00Z' const dateInput2 = '2022-02-02T00:00:00Z' const dateOutput1 = new Date(dateInput1) const dateOutput2 = new Date(dateInput2) beforeAll(async () => { await prisma.resource.create({ data: { date: dateInput1 }, }) await prisma.resource.create({ data: { date: dateInput2 }, }) }) test('findUnique date with Promise.all', async () => { const result = await Promise.all([ prisma.resource.findUnique({ where: { date: dateInput1 }, select: { date: true }, }), prisma.resource.findUnique({ where: { date: dateInput2 }, select: { date: true }, }), ]) expect(result).toMatchObject([{ date: dateOutput1 }, { date: dateOutput2 }]) }) test('findUnique date with $transaction([...])', async () => { const result = await prisma.$transaction([ prisma.resource.findUnique({ where: { date: dateInput1 }, select: { date: true }, }), prisma.resource.findUnique({ where: { date: dateInput2 }, select: { date: true }, }), ]) expect(result).toMatchObject([{ date: dateOutput1 }, { date: dateOutput2 }]) }) test('findFirst date with Promise.all', async () => { const result = await Promise.all([ prisma.resource.findFirst({ where: { date: dateInput1 }, select: { date: true }, }), prisma.resource.findFirst({ where: { date: dateInput2 }, select: { date: true }, }), ]) expect(result).toMatchObject([{ date: dateOutput1 }, { date: dateOutput2 }]) }) test('findFirst date with $transaction([...])', async () => { const result = await prisma.$transaction([ prisma.resource.findFirst({ where: { date: dateInput1 }, select: { date: true }, }), prisma.resource.findFirst({ where: { date: dateInput2 }, select: { date: true }, }), ]) expect(result).toMatchObject([{ date: dateOutput1 }, { date: dateOutput2 }]) }) })

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/prisma/prisma'

If you have feedback or need assistance with the MCP directory API, please join our Discord server