Skip to main content
Glama
sftp.test.ts1.02 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { Readable } from 'stream'; import { streamToBuffer } from './sftp'; describe('sftp', () => { test('Return a Buffer', async () => { const input = 'test data'; const stream = Readable.from(input); const expectedBuffer = Buffer.from(input); const result = await streamToBuffer(stream); expect(result).toStrictEqual(expectedBuffer); }); test('Empty Readable stream', async () => { const stream = Readable.from(''); const expectedBuffer = Buffer.from(''); const result = await streamToBuffer(stream); expect(result).toStrictEqual(expectedBuffer); }); test('Error event and reject with an error', async () => { const errorMessage = 'test error'; const stream = new Readable({ read() { this.emit('error', new Error(errorMessage)); }, }); await expect(streamToBuffer(stream)).rejects.toThrow(errorMessage); }); });

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