test: compare download stream buffers directly so it stops timing out

This commit is contained in:
LukeGus committed 2026-10-03 15:59:46 -05:00
1 parent 7156ac1af3
commit fa21a7a458
1 file changed
+7 -3
@@ -58,9 +58,13 @@ describe("SFTP download stream", () => {
const data = Buffer.alloc(1024 * 1024 + 123);
for (let i = 0; i < data.length; i++) data[i] = (i * 13 + (i >>> 8)) % 256;
const remote = source(data);
expect(
await contents(createDownloadStream(remote.sftp, "/file", data.length)),
).toEqual(data);
const received = await contents(
createDownloadStream(remote.sftp, "/file", data.length),
);
// toEqual walks a 1 MB buffer byte by byte, slow enough to time out
// when every plugin suite runs at once.
expect(received.length).toBe(data.length);
expect(received.equals(data)).toBe(true);
expect(remote.peak()).toBe(8);
expect(remote.closedWithPending).toEqual([0]);
});