From e9c875dcaf53a735c760845220198fb0332549cf Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Wed, 18 Jan 2023 02:16:50 +0800 Subject: [PATCH] squash: add `bytesRead === length` assertions --- test/parallel/test-fs-promises-write-optional-params.js | 1 + test/parallel/test-fs-write-optional-params.js | 1 + test/parallel/test-fs-write-sync-optional-params.js | 1 + 3 files changed, 3 insertions(+) diff --git a/test/parallel/test-fs-promises-write-optional-params.js b/test/parallel/test-fs-promises-write-optional-params.js index c87f6a35db08c36..4dd871551537699 100644 --- a/test/parallel/test-fs-promises-write-optional-params.js +++ b/test/parallel/test-fs-promises-write-optional-params.js @@ -54,6 +54,7 @@ async function testValid(dest, buffer, options) { assert.ok(writeResult.bytesWritten >= readResult.bytesRead); if (length !== undefined && length !== null) { assert.strictEqual(writeResult.bytesWritten, length); + assert.strictEqual(readResult.bytesRead, length); } if (offset === undefined || offset === 0) { assert.deepStrictEqual(writeBufCopy, readBufCopy); diff --git a/test/parallel/test-fs-write-optional-params.js b/test/parallel/test-fs-write-optional-params.js index c5660a18d6817c1..11390ad42dbfd48 100644 --- a/test/parallel/test-fs-write-optional-params.js +++ b/test/parallel/test-fs-write-optional-params.js @@ -40,6 +40,7 @@ function testValidCb(buffer, options, index, callback) { assert.ok(bytesWritten >= bytesRead); if (length !== undefined && length !== null) { assert.strictEqual(bytesWritten, length); + assert.strictEqual(bytesRead, length); } if (offset === undefined || offset === 0) { assert.deepStrictEqual(writeBufCopy, readBufCopy); diff --git a/test/parallel/test-fs-write-sync-optional-params.js b/test/parallel/test-fs-write-sync-optional-params.js index bca19eddde28f97..ac2c501f682242d 100644 --- a/test/parallel/test-fs-write-sync-optional-params.js +++ b/test/parallel/test-fs-write-sync-optional-params.js @@ -51,6 +51,7 @@ function testValid(dest, buffer, options) { assert.ok(bytesWritten >= bytesRead); if (length !== undefined && length !== null) { assert.strictEqual(bytesWritten, length); + assert.strictEqual(bytesRead, length); } }