Skip to content

Commit

Permalink
test: more
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Mar 12, 2024
1 parent 9563a95 commit 3c5eefd
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions test/DirectoryWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,30 @@ describe("DirectoryWatcher", function() {
});
});

it("should not report directory as initial missing on the second watch", function(done) {
it("should report directory as initial missing on the second watch when directory doesn't exist", function(done) {
var wm = getWatcherManager({});
testHelper.dir("dir1");
wm.watchDirectory(path.join(fixtures, "dir1"));

testHelper.tick(function() {
var initialMissing = false;
wm.watchDirectory(path.join(fixtures, "dir3")).on(
"initial-missing",
() => {
initialMissing = true;
}
);
testHelper.tick(function() {
for (const [, w] of wm.directoryWatchers) {
w.close();
}
initialMissing.should.be.eql(true);
done();
});
});
});

it("should not report directory as initial missing on the second watch when directory exists", function(done) {
var wm = getWatcherManager({});
testHelper.dir("dir1");
wm.watchDirectory(path.join(fixtures, "dir1"));
Expand All @@ -182,7 +205,7 @@ describe("DirectoryWatcher", function() {
initialMissing = true;
}
);
process.nextTick(() => {
testHelper.tick(function() {
for (const [, w] of wm.directoryWatchers) {
w.close();
}
Expand Down

0 comments on commit 3c5eefd

Please sign in to comment.