From 315d0c0160a95ca2d6e10177f3e047b1853f5d43 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Fri, 10 May 2019 12:54:43 -0400 Subject: [PATCH 1/4] Improve description on built-in stat ctor test --- test/stats.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/stats.js b/test/stats.js index 4519012..3274678 100644 --- a/test/stats.js +++ b/test/stats.js @@ -5,7 +5,7 @@ var gfs = require('../graceful-fs.js') test('graceful fs uses same stats constructor as fs', function (t) { t.equal(gfs.Stats, fs.Stats, 'should reference the same constructor') t.ok(fs.statSync(__filename) instanceof fs.Stats, - 'should be instance of fs.Stats') + 'should be instance of fs.Stats (built-in fs.statSync call)') t.ok(gfs.statSync(__filename) instanceof fs.Stats, 'should be instance of fs.Stats') t.end() From ced7c98e4ca8bc81415758c8ad8586d669daee77 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Fri, 10 May 2019 12:56:31 -0400 Subject: [PATCH 2/4] Add async fs stats constructor test --- test/stats.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/stats.js b/test/stats.js index 3274678..a7cbfea 100644 --- a/test/stats.js +++ b/test/stats.js @@ -10,3 +10,12 @@ test('graceful fs uses same stats constructor as fs', function (t) { 'should be instance of fs.Stats') t.end() }) + +test('graceful fs uses same stats constructor as fs (async)', function (t) { + gfs.stat(__filename, function (er, stats) { + t.notOk(er, 'should not receive an error result') + t.ok(stats, 'should receive a valid stats object') + t.ok(stats instanceof fs.Stats, 'should receive a valid stats object') + t.end() + }) +}) From 524bdf46c0e0c04828890cf00953780327307355 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Fri, 10 May 2019 12:57:19 -0400 Subject: [PATCH 3/4] statSync uid & gid test fixes - fix test description - remove duplicated Stats constructor check --- test/stats-uid-gid.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/stats-uid-gid.js b/test/stats-uid-gid.js index 58ce661..4b638be 100644 --- a/test/stats-uid-gid.js +++ b/test/stats-uid-gid.js @@ -14,9 +14,7 @@ fs.statSync = function(path) { var gfs = require('../graceful-fs.js') -test('graceful fs uses same stats constructor as fs', function (t) { - t.equal(gfs.Stats, fs.Stats, 'should reference the same constructor') - +test('graceful fs includes correct uid & gid', function (t) { if (!process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH) { t.equal(fs.statSync(__filename).uid, -2) t.equal(fs.statSync(__filename).gid, -2) From bff7fd158cc25f14fae04c1850886e879ae90833 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Fri, 10 May 2019 14:13:59 -0400 Subject: [PATCH 4/4] Add async test of stat uid & gid (skipped on "win32" platform) --- test/stats-uid-gid.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/stats-uid-gid.js b/test/stats-uid-gid.js index 4b638be..11d6b84 100644 --- a/test/stats-uid-gid.js +++ b/test/stats-uid-gid.js @@ -26,6 +26,16 @@ test('graceful fs includes correct uid & gid', function (t) { t.end() }) +;(process.platform !== 'win32') && test('graceful fs includes valid uid & gid (async)', function (t) { + gfs.stat(__filename, function (er, stats) { + t.notOk(er) + t.ok(stats) + t.ok(stats.uid) + t.ok(stats.gid) + t.end() + }) +}) + test('does not throw when async stat fails', function (t) { gfs.stat(__filename + ' this does not exist', function (er, stats) { t.ok(er)