Skip to main content
Glama
migration-utils.test.ts1.2 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { loadTestConfig } from '../config/loader'; import { closeDatabase, initDatabase } from '../database'; import { getPostDeployMigration, MigrationDefinitionNotFoundError, withLongRunningDatabaseClient, } from './migration-utils'; describe('withLongRunningDatabaseClient', () => { beforeAll(async () => { const config = await loadTestConfig(); await initDatabase(config); }); afterAll(async () => { await closeDatabase(); }); test('should execute callback with long-running database client', async () => { const result = await withLongRunningDatabaseClient(async (client) => { return client.query<{ result: string }>("SELECT '12-12-2022' as result").then((result) => result.rows[0].result); }); expect(result).toBe('12-12-2022'); }); }); describe('getPostDeployMigration', () => { test('definition found', () => { expect(getPostDeployMigration(1)).toBeDefined(); }); test('migration definition not found', () => { expect(() => getPostDeployMigration(9999)).toThrow(MigrationDefinitionNotFoundError); }); });

Latest Blog Posts

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/medplum/medplum'

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