Fix time-based tests to not fail in node, since operations on Memory run faster

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-05-16 14:46:02 -04:00 committed by Kieran Sedgwick
parent b0744a7489
commit 89c44f2f72
3 changed files with 40 additions and 40 deletions

View File

@ -168,8 +168,8 @@ define(["Filer", "util"], function(Filer, util) {
// Note: testing estimation as time may differ by a couple of milliseconds
// This number should be increased if tests are on slow systems
var delta = Date.now() - then;
expect(then - stat.atime).to.be.below(delta);
expect(then - stat.mtime).to.be.below(delta);
expect(then - stat.atime).to.be.at.most(delta);
expect(then - stat.mtime).to.be.at.most(delta);
done();
});
});

View File

@ -91,9 +91,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat(fs, filename, function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.equal(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});

View File

@ -40,9 +40,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat(newfilename, function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.equal(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});
@ -60,9 +60,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat(filename, function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.mtime).to.be.above(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.be.at.least(stats1.mtime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});
@ -83,9 +83,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat(filename, function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.mtime).to.be.above(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.be.at.least(stats1.mtime);
expect(stats2.atime).to.be.at.least(stats1.atime);
fs.close(fd, done);
});
@ -188,9 +188,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat(filename, function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.equal(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});
@ -250,9 +250,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat(dirname, function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.mtime).to.be.above(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.be.at.least(stats1.mtime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});
@ -273,9 +273,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat('/', function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.mtime).to.be.above(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.be.at.least(stats1.mtime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});
@ -294,9 +294,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat('/', function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.mtime).to.be.above(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.be.at.least(stats1.mtime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});
@ -367,9 +367,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat('/myfile', function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.mtime).to.be.above(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.be.at.least(stats1.mtime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});
@ -447,9 +447,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat(filename, function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.mtime).to.be.above(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.be.at.least(stats1.mtime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});
@ -466,9 +466,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat(filename, function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.mtime).to.be.above(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.be.at.least(stats1.mtime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});
@ -485,9 +485,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat(filename, function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.equal(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});
@ -507,9 +507,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat(filename, function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.equal(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});
@ -580,9 +580,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat(filename, function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.equal(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});
@ -606,9 +606,9 @@ define(["Filer", "util"], function(Filer, util) {
if(error) throw error;
stat(filename, function(stats2) {
expect(stats2.ctime).to.be.above(stats1.ctime);
expect(stats2.ctime).to.be.at.least(stats1.ctime);
expect(stats2.mtime).to.equal(stats1.mtime);
expect(stats2.atime).to.be.above(stats1.atime);
expect(stats2.atime).to.be.at.least(stats1.atime);
done();
});
});