Skip to main content
Glama

Prisma MCP Server

Official
by prisma
Apache 2.0
4
44,192
  • Linux
  • Apple
Cache.test.ts1.34 kB
import { expect, test, vi } from 'vitest' import { Cache } from './Cache' test('creating an item', () => { const cache = new Cache<string, string>() const result = cache.getOrCreate('foo', () => 'hello!') expect(result).toBe('hello!') }) test('retrieving an item', () => { const cache = new Cache<string, object>() const result1 = cache.getOrCreate('foo', () => ({ value: 'hello!' })) const result2 = cache.getOrCreate('foo', () => ({ value: 'hello!' })) expect(result2).toBe(result1) }) test('creating items with different keys', () => { const cache = new Cache<string, object>() const result1 = cache.getOrCreate('foo', () => ({ value: 'hello!' })) const result2 = cache.getOrCreate('bar', () => ({ value: 'hello!' })) expect(result2).not.toBe(result1) }) test('retrieving an does not trigger callback', () => { const callback = vi.fn().mockReturnValue('hello!') const cache = new Cache<string, object>() cache.getOrCreate('foo', callback) cache.getOrCreate('foo', callback) expect(callback).toHaveBeenCalledTimes(1) }) test('it is possible to store undefined values', () => { const callback = vi.fn().mockReturnValue(undefined) const cache = new Cache<string, undefined>() cache.getOrCreate('foo', callback) cache.getOrCreate('foo', callback) expect(callback).toHaveBeenCalledTimes(1) })

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