Commit 836cbc9
committed
Fix use of stream.write(data, encoding) in tests
For several tests I used a shortcut to write an list-of-chunks to a
stream:
chunks.forEach(stream.write.bind(stream));
This is a quick way to make a function from a method. The problem is
that `forEach` will pass the index of the array item as a second
argument, and `write` has a second argument (buffer) `encoding`. In
Node v15, the encoding is actually checked to see if it's valid -- and
numbers are not valid buffer encodings:
nodejs/node#33075
The fix is simply to be explicit about which arguments are passed,
rather than relying on the shortcut. This is a little more verbose,
but can still be put in line at least.
Signed-off-by: Michael Bridgen <[email protected]>1 parent 28cd533 commit 836cbc9
2 files changed
+5
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
0 commit comments