Skip to content

Commit 2b8b40f

Browse files
BridgeARMylesBorins
authored andcommitted
test: fix a TODO and remove obsolete TODOs
This removes outdated TODOs and adds a test for invalid input in `fs.copyFile` and solves a TODO by doing so. PR-URL: #20319 Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 645a97a commit 2b8b40f

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

lib/url.js

-3
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,6 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
281281
// http://a@b@c/ => user:a@b host:c
282282
// http://a@b?@c => user:a host:b path:/?@c
283283

284-
// v0.12 TODO(isaacs): This is not quite how Chrome does things.
285-
// Review our test case against browsers more comprehensively.
286-
287284
var hostEnd = -1;
288285
var atSign = -1;
289286
var nonHost = -1;

test/parallel/test-cluster-http-pipe.js

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ if (cluster.isMaster) {
4545
http.createServer(common.mustCall((req, res) => {
4646
assert.strictEqual(req.connection.remoteAddress, undefined);
4747
assert.strictEqual(req.connection.localAddress, undefined);
48-
// TODO common.PIPE?
4948

5049
res.writeHead(200);
5150
res.end('OK');

test/parallel/test-fs-error-messages.js

+11-12
Original file line numberDiff line numberDiff line change
@@ -636,22 +636,21 @@ if (!common.isAIX) {
636636
);
637637
}
638638

639-
// copyFile with invalid flags
639+
// Check copyFile with invalid flags.
640640
{
641-
const validateError = (err) => {
642-
assert.strictEqual(err.message,
643-
'EINVAL: invalid argument, copyfile ' +
644-
`'${existingFile}' -> '${nonexistentFile}'`);
645-
assert.strictEqual(err.errno, uv.UV_EINVAL);
646-
assert.strictEqual(err.code, 'EINVAL');
647-
assert.strictEqual(err.syscall, 'copyfile');
648-
return true;
641+
const validateError = {
642+
// TODO: Make sure the error message always also contains the src.
643+
message: `EINVAL: invalid argument, copyfile -> '${nonexistentFile}'`,
644+
errno: uv.UV_EINVAL,
645+
code: 'EINVAL',
646+
syscall: 'copyfile'
649647
};
650648

651-
// TODO(joyeecheung): test fs.copyFile() when uv_fs_copyfile does not
652-
// keep the loop open when the flags are invalid.
653-
// See https://github.com/libuv/libuv/pull/1747
649+
fs.copyFile(existingFile, nonexistentFile, -1,
650+
common.expectsError(validateError));
654651

652+
validateError.message = 'EINVAL: invalid argument, copyfile ' +
653+
`'${existingFile}' -> '${nonexistentFile}'`;
655654
assert.throws(
656655
() => fs.copyFileSync(existingFile, nonexistentFile, -1),
657656
validateError

test/parallel/test-util-isDeepStrictEqual.js

-2
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,6 @@ notUtilIsDeepStrict([1, , , 3], [1, , , 3, , , ]);
419419
const err3 = new TypeError('foo1');
420420
notUtilIsDeepStrict(err1, err2, assert.AssertionError);
421421
notUtilIsDeepStrict(err1, err3, assert.AssertionError);
422-
// TODO: evaluate if this should throw or not. The same applies for RegExp
423-
// Date and any object that has the same keys but not the same prototype.
424422
notUtilIsDeepStrict(err1, {}, assert.AssertionError);
425423
}
426424

0 commit comments

Comments
 (0)