Browse Source

Added a guard.

Eugene Lazutkin 3 năm trước cách đây
mục cha
commit
9a02c1c4f9
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      tests/helpers.mjs

+ 1 - 1
tests/helpers.mjs

@@ -13,7 +13,7 @@ export const streamToArray = array =>
 
 export const readString = (string, quant) => new Readable({
   read() {
-    if (isNaN(quant)) {
+    if (isNaN(quant) || quant < 1) {
       this.push(string);
     } else if (string instanceof Buffer) {
       for (let i = 0; i < string.length; i += quant) {