Skip to main content
Glama
dbstats.test.ts1.88 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { ContentType } from '@medplum/core'; import type { Parameters } from '@medplum/fhirtypes'; import express from 'express'; import request from 'supertest'; import { initApp, shutdownApp } from '../../app'; import { loadTestConfig } from '../../config/loader'; import { initTestAuth } from '../../test.setup'; describe('$db-stats', () => { const app = express(); beforeAll(async () => { const config = await loadTestConfig(); await initApp(app, config); }); afterAll(async () => { await shutdownApp(); }); test('Success', async () => { const accessToken = await initTestAuth({ project: { superAdmin: true } }); const res1 = await request(app) .post('/fhir/R4/$db-stats') .set('Authorization', 'Bearer ' + accessToken) .set('Content-Type', ContentType.FHIR_JSON) .send({}); expect(res1.status).toBe(200); }); test('Success - Specified table names', async () => { const accessToken = await initTestAuth({ project: { superAdmin: true } }); const res1 = await request(app) .post('/fhir/R4/$db-stats') .set('Authorization', 'Bearer ' + accessToken) .set('Content-Type', ContentType.FHIR_JSON) .send({ resourceType: 'Parameters', parameter: [{ name: 'tableNames', valueString: 'Observation,Observation_History' }], } satisfies Parameters); expect(res1.status).toBe(200); }); test('Access denied', async () => { const accessToken = await initTestAuth({ project: { superAdmin: false } }); const res1 = await request(app) .post('/fhir/R4/$db-stats') .set('Authorization', 'Bearer ' + accessToken) .set('Content-Type', ContentType.FHIR_JSON) .send({}); expect(res1.status).toBe(403); }); });

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