From e138bca39dfb645d409adf4bdb7b4e5e0ecf8774 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Mon, 14 Oct 2024 13:55:14 +0200 Subject: [PATCH] fix(WebDuplexStream): Fix variable naming inconsistency in WebDuplexStream test --- changelog.md | 6 ++++++ test/test.ts_web.both.ts | 12 ++++++------ ts/00_commitinfo_data.ts | 2 +- ts_web/00_commitinfo_data.ts | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/changelog.md b/changelog.md index 4492c31..57543d0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2024-10-14 - 3.1.2 - fix(WebDuplexStream) +Fix variable naming inconsistency in WebDuplexStream test + +- Changed variable names from 'transformStream' to 'webDuplexStream' for consistency. +- Renamed 'writableStream' and 'readableStream' to 'writer' and 'reader' respectively. + ## 2024-10-13 - 3.1.1 - fix(WebDuplexStream) Improved read/write interface and error handling in WebDuplexStream diff --git a/test/test.ts_web.both.ts b/test/test.ts_web.both.ts index c96e111..895ed27 100644 --- a/test/test.ts_web.both.ts +++ b/test/test.ts_web.both.ts @@ -28,22 +28,22 @@ tap.test('WebDuplexStream should handle transform with a write function', async const input = [1, 2, 3, 4, 5]; const expectedOutput = [2, 4, 6, 8, 10]; - const transformStream = new webstream.WebDuplexStream({ + const webDuplexStream = new webstream.WebDuplexStream({ writeFunction: async (chunk, { push }) => { // Push the doubled number into the stream push(chunk * 2); }, }); - const writableStream = transformStream.writable.getWriter(); - const readableStream = transformStream.readable.getReader(); + const writer = webDuplexStream.writable.getWriter(); + const reader = webDuplexStream.readable.getReader(); const output: number[] = []; // Read from the stream asynchronously const readPromise = (async () => { while (true) { - const { value, done } = await readableStream.read(); + const { value, done } = await reader.read(); if (done) break; if (value !== undefined) { output.push(value); @@ -53,9 +53,9 @@ tap.test('WebDuplexStream should handle transform with a write function', async // Write to the stream for (const num of input) { - await writableStream.write(num); + await writer.write(num); } - await writableStream.close(); + await writer.close(); // Wait for the reading to complete await readPromise; diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 3de2185..70ba700 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartstream', - version: '3.1.1', + version: '3.1.2', description: 'A library to simplify the creation and manipulation of Node.js streams, providing utilities for handling transform, duplex, and readable/writable streams effectively in TypeScript.' } diff --git a/ts_web/00_commitinfo_data.ts b/ts_web/00_commitinfo_data.ts index 3de2185..70ba700 100644 --- a/ts_web/00_commitinfo_data.ts +++ b/ts_web/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartstream', - version: '3.1.1', + version: '3.1.2', description: 'A library to simplify the creation and manipulation of Node.js streams, providing utilities for handling transform, duplex, and readable/writable streams effectively in TypeScript.' }