Skip to content

Commit

Permalink
Add test for getStreamAsBuffer() when Buffer is not available (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky authored Aug 13, 2023
1 parent a23e899 commit c1df6e8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,15 @@ test('getStreamAsBuffer() behaves like buffer()', async t => {
]);
t.deepEqual(nativeResult, customResult);
});

/* eslint-disable n/prefer-global/buffer */
test('getStreamAsBuffer() only works in Node', async t => {
const {Buffer} = globalThis;
delete globalThis.Buffer;
try {
await t.throwsAsync(setupBuffer([fixtureString]), {message: /only supported in Node/});
} finally {
globalThis.Buffer = Buffer;
}
});
/* eslint-enable n/prefer-global/buffer */

0 comments on commit c1df6e8

Please sign in to comment.