Skip to main content
Glama

Prisma MCP Server

Official
by prisma
Apache 2.0
4
44,213
  • Linux
  • Apple
tests.ts2.96 kB
import { Providers } from '../_utils/providers' import testMatrix from './_matrix' // @ts-ignore import type { PrismaClient } from './generated/prisma/client' declare let prisma: PrismaClient testMatrix.setupTestSuite( () => { beforeAll(async () => { await prisma.user.create({ data: { age: 1, name: null, }, }) await prisma.user.create({ data: { age: 2, name: 'a', }, }) await prisma.user.create({ data: { age: 3, name: null, }, }) await prisma.user.create({ data: { age: 4, name: 'b', }, }) }) test('should return records sorted by name asc and null first', async () => { const records = await prisma.user.findMany({ select: { name: true, }, orderBy: { name: { sort: 'asc', nulls: 'first', }, }, }) expect(records).toMatchObject([ { name: null, }, { name: null, }, { name: 'a', }, { name: 'b', }, ]) }) test('should return records sorted by name asc and null last', async () => { const records = await prisma.user.findMany({ select: { name: true, }, orderBy: { name: { sort: 'asc', nulls: 'last', }, }, }) expect(records).toMatchObject([ { name: 'a', }, { name: 'b', }, { name: null, }, { name: null, }, ]) }) test('should return records sorted by name desc and null first', async () => { const records = await prisma.user.findMany({ select: { name: true, }, orderBy: { name: { sort: 'desc', nulls: 'first', }, }, }) expect(records).toMatchObject([ { name: null, }, { name: null, }, { name: 'b', }, { name: 'a', }, ]) }) test('should return records sorted by name desc and null last', async () => { const records = await prisma.user.findMany({ select: { name: true, }, orderBy: { name: { sort: 'desc', nulls: 'last', }, }, }) expect(records).toMatchObject([ { name: 'b', }, { name: 'a', }, { name: null, }, { name: null, }, ]) }) }, { optOut: { from: [Providers.MONGODB], reason: 'Orderby Null not supported on mongodb', }, }, )

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