Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 76bb3cb

Browse filesBrowse files
TrottMylesBorins
authored andcommitted
test: refactor test-stream2-writable
* add duration to setTimeout() * assert.equal() -> assert.strictEqual() * remove unused function arguments * normalize indentation PR-URL: #10353 Reviewed-By: Julian Duque <julianduquej@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent b87ee26 commit 76bb3cb
Copy full SHA for 76bb3cb

File tree

Expand file treeCollapse file tree

1 file changed

+31
-31
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+31
-31
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-stream2-writable.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream2-writable.js
+31-31Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ function run() {
4545
var fn = next[1];
4646
console.log('# %s', name);
4747
fn({
48-
same: assert.deepEqual,
49-
equal: assert.equal,
48+
same: assert.deepStrictEqual,
49+
equal: assert.strictEqual,
5050
end: function() {
5151
count--;
5252
run();
@@ -56,7 +56,7 @@ function run() {
5656

5757
// ensure all tests have run
5858
process.on('exit', function() {
59-
assert.equal(count, 0);
59+
assert.strictEqual(count, 0);
6060
});
6161

6262
process.nextTick(run);
@@ -136,17 +136,17 @@ test('write bufferize', function(t) {
136136
});
137137

138138
var encodings =
139-
[ 'hex',
140-
'utf8',
141-
'utf-8',
142-
'ascii',
143-
'binary',
144-
'base64',
145-
'ucs2',
146-
'ucs-2',
147-
'utf16le',
148-
'utf-16le',
149-
undefined ];
139+
[ 'hex',
140+
'utf8',
141+
'utf-8',
142+
'ascii',
143+
'binary',
144+
'base64',
145+
'ucs2',
146+
'ucs-2',
147+
'utf16le',
148+
'utf-16le',
149+
undefined ];
150150

151151
tw.on('finish', function() {
152152
t.same(tw.buffer, chunks, 'got the expected chunks');
@@ -173,17 +173,17 @@ test('write no bufferize', function(t) {
173173
};
174174

175175
var encodings =
176-
[ 'hex',
177-
'utf8',
178-
'utf-8',
179-
'ascii',
180-
'binary',
181-
'base64',
182-
'ucs2',
183-
'ucs-2',
184-
'utf16le',
185-
'utf-16le',
186-
undefined ];
176+
[ 'hex',
177+
'utf8',
178+
'utf-8',
179+
'ascii',
180+
'binary',
181+
'base64',
182+
'ucs2',
183+
'ucs-2',
184+
'utf16le',
185+
'utf-16le',
186+
undefined ];
187187

188188
tw.on('finish', function() {
189189
t.same(tw.buffer, chunks, 'got the expected chunks');
@@ -199,7 +199,7 @@ test('write no bufferize', function(t) {
199199

200200
test('write callbacks', function(t) {
201201
var callbacks = chunks.map(function(chunk, i) {
202-
return [i, function(er) {
202+
return [i, function() {
203203
callbacks._called[i] = chunk;
204204
}];
205205
}).reduce(function(set, x) {
@@ -270,7 +270,7 @@ test('end callback called after write callback', function(t) {
270270
test('encoding should be ignored for buffers', function(t) {
271271
var tw = new W();
272272
var hex = '018b5e9a8f6236ffe30e31baf80d2cf6eb';
273-
tw._write = function(chunk, encoding, cb) {
273+
tw._write = function(chunk) {
274274
t.equal(chunk.toString('hex'), hex);
275275
t.end();
276276
};
@@ -282,7 +282,7 @@ test('writables are not pipable', function(t) {
282282
var w = new W();
283283
w._write = function() {};
284284
var gotError = false;
285-
w.on('error', function(er) {
285+
w.on('error', function() {
286286
gotError = true;
287287
});
288288
w.pipe(process.stdout);
@@ -295,7 +295,7 @@ test('duplexes are pipable', function(t) {
295295
d._read = function() {};
296296
d._write = function() {};
297297
var gotError = false;
298-
d.on('error', function(er) {
298+
d.on('error', function() {
299299
gotError = true;
300300
});
301301
d.pipe(process.stdout);
@@ -329,7 +329,7 @@ test('dont end while writing', function(t) {
329329
setTimeout(function() {
330330
this.writing = false;
331331
cb();
332-
});
332+
}, 1);
333333
};
334334
w.on('finish', function() {
335335
assert(wrote);
@@ -366,7 +366,7 @@ test('finish does not come before sync _write cb', function(t) {
366366
assert(writeCb);
367367
t.end();
368368
});
369-
w.write(Buffer(0), function(er) {
369+
w.write(Buffer.alloc(0), function() {
370370
writeCb = true;
371371
});
372372
w.end();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.