import { expect, tap } from '@push.rocks/tapbundle'; import { SmartDuplex } from '../ts/smartstream.classes.smartduplex.js'; // Adjust the import to your file structure import * as smartrx from '@push.rocks/smartrx'; import * as fs from 'fs'; tap.test('should create a SmartStream from a Buffer', async () => { const bufferData = Buffer.from('This is a test buffer'); const smartStream = SmartDuplex.fromBuffer(bufferData, {}); let receivedData = Buffer.alloc(0); return new Promise((resolve) => { smartStream.on('data', (chunk: Buffer) => { receivedData = Buffer.concat([receivedData, chunk]); }); smartStream.on('end', () => { expect(receivedData.toString()).toEqual(bufferData.toString()); resolve(); }); }); }); tap.start();