Skip to main content
Glama
channel.test.ts2.17 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { ContentType } from '@medplum/core'; import type { Endpoint } from '@medplum/fhirtypes'; import { getChannelTypeShortName } from './channel'; describe('Channel', () => { describe('getChannelTypeShortName', () => { test.each([ { address: 'mllp://0.0.0.0:9001', shortName: 'HL7', endpoint: { resourceType: 'Endpoint', address: 'mllp://0.0.0.0:9001', status: 'active', connectionType: { code: ContentType.HL7_V2 }, payloadType: [{ coding: [{ code: ContentType.HL7_V2 }] }], }, }, { address: 'dicom://0.0.0.0:9001', shortName: 'DICOM', endpoint: { resourceType: 'Endpoint', address: 'dicom://0.0.0.0:9001', status: 'active', connectionType: { code: ContentType.DICOM }, payloadType: [{ coding: [{ code: ContentType.DICOM }] }], }, }, { address: 'tcp://0.0.0.0:9001', shortName: 'Byte Stream', endpoint: { resourceType: 'Endpoint', address: 'tcp://0.0.0.0:9001', status: 'active', connectionType: { code: ContentType.OCTET_STREAM }, payloadType: [{ coding: [{ code: ContentType.OCTET_STREAM }] }], }, }, ] as { endpoint: Endpoint; shortName: string; address: string }[])( 'getChannelTypeShortName({ "resourceType": "Endpoint", "address": "$address" }) = $shortName', ({ endpoint, shortName }) => { expect(getChannelTypeShortName(endpoint)).toStrictEqual(shortName); } ); }); test('should throw on unknown endpoint type', () => { const endpoint: Endpoint = { resourceType: 'Endpoint', address: 'serial://0.0.0.0:9001', status: 'active', connectionType: { code: ContentType.OCTET_STREAM }, payloadType: [{ coding: [{ code: ContentType.OCTET_STREAM }] }], }; expect(() => getChannelTypeShortName(endpoint)).toThrow(`Invalid endpoint type with address '${endpoint.address}'`); }); });

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