From 9c932b4743b0ed518a0d4bf8001c10931d9b25ed Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Fri, 16 May 2014 14:46:02 -0400 Subject: [PATCH] Fix time-based tests to not fail in node, since operations on Memory run faster --- tests/spec/fs.utimes.spec.js | 4 +- tests/spec/time-flags.spec.js | 4 +- tests/spec/times.spec.js | 72 +++++++++++++++++------------------ 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/tests/spec/fs.utimes.spec.js b/tests/spec/fs.utimes.spec.js index cdf5213..4cddbb1 100644 --- a/tests/spec/fs.utimes.spec.js +++ b/tests/spec/fs.utimes.spec.js @@ -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(); }); }); diff --git a/tests/spec/time-flags.spec.js b/tests/spec/time-flags.spec.js index 49b17a4..3208e1f 100644 --- a/tests/spec/time-flags.spec.js +++ b/tests/spec/time-flags.spec.js @@ -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(); }); }); diff --git a/tests/spec/times.spec.js b/tests/spec/times.spec.js index 835b005..f1d9a41 100644 --- a/tests/spec/times.spec.js +++ b/tests/spec/times.spec.js @@ -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(); }); });