瀏覽代碼

Added a guard.

Eugene Lazutkin 3 年之前
父節點
當前提交
9a02c1c4f9
共有 1 個文件被更改,包括 1 次插入1 次删除
  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) {