Permalink
Browse files

updating stat times in rmdir() and unlin() as per #1 (comment)

  • Loading branch information...
1 parent e91eee1 commit 958b95847ada9dcfe618db5556da9ddb240a0d89 @tgeorgiev tgeorgiev committed Jan 26, 2013
Showing with 18 additions and 0 deletions.
  1. +2 −0 lib/fake-fs.js
  2. +16 −0 test/fake-fs.js
View
2 lib/fake-fs.js
@@ -116,6 +116,7 @@ Fs.prototype.rmdirSync = function (path) {
var parent = this._get(dirname(path));
if (!parent.isDirectory()) throw FsError('ENOTDIR');
+ updateTimes(parent)
var itemName = basename(path);
delete parent.childs[itemName];
}
@@ -129,6 +130,7 @@ Fs.prototype.unlinkSync = function (path) {
var parent = this._get(dirname(path));
if (!parent.isDirectory()) throw FsError('ENOTDIR');
+ updateTimes(parent)
var itemName = basename(path);
delete parent.childs[itemName];
}
View
16 test/fake-fs.js
@@ -252,6 +252,14 @@ describe('Fake FS', function () {
cb.error('ENOTDIR')
})
+
+ it('Should update dir times on directory removal', function (done) {
+ fs.dir('a/b')
+
+ testTimesUpdated('a', function () {
+ fs.rmdir('a/b')
+ }, done)
+ })
})
describe('.unlink()', function () {
@@ -270,6 +278,14 @@ describe('Fake FS', function () {
cb.error('EISDIR')
})
+
+ it('Should update dir times on file removal', function (done) {
+ fs.file('a/file.txt')
+
+ testTimesUpdated('a', function () {
+ fs.unlink('a/file.txt')
+ }, done)
+ })
})
describe('.readFile()', function () {

0 comments on commit 958b958

Please sign in to comment.