test: improve fs.exists coverage
By adding a test case using a path with illegal protocol PR-URL: https://github.com/nodejs/node/pull/14301 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
This commit is contained in:
parent
97c4033ebf
commit
201e756ef1
@ -23,6 +23,7 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const { URL } = require('url');
|
||||||
const f = __filename;
|
const f = __filename;
|
||||||
|
|
||||||
fs.exists(f, common.mustCall(function(y) {
|
fs.exists(f, common.mustCall(function(y) {
|
||||||
@ -33,5 +34,9 @@ fs.exists(`${f}-NO`, common.mustCall(function(y) {
|
|||||||
assert.strictEqual(y, false);
|
assert.strictEqual(y, false);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
fs.exists(new URL('https://foo'), common.mustCall(function(y) {
|
||||||
|
assert.strictEqual(y, false);
|
||||||
|
}));
|
||||||
|
|
||||||
assert(fs.existsSync(f));
|
assert(fs.existsSync(f));
|
||||||
assert(!fs.existsSync(`${f}-NO`));
|
assert(!fs.existsSync(`${f}-NO`));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user