Files
directus/packages/utils/node/readable-stream-to-string.test.ts
2023-11-20 16:23:22 +01:00

12 lines
412 B
TypeScript

import { test, expect } from 'vitest';
import { Readable } from 'node:stream';
import { readableStreamToString } from './readable-stream-to-string.js';
test.each([Readable.from('test', { encoding: 'utf8' }), Readable.from(Buffer.from([0x74, 0x65, 0x73, 0x74]))])(
'Returns readable stream as string',
async (readableStream) => {
expect(readableStreamToString(readableStream)).resolves.toBe('test');
},
);