Permalink
Browse files

Fixed wrong test

  • Loading branch information...
1 parent a2c715c commit d96f3a996de76d61e82a48d21fa758c48f8ba5b0 @kusor kusor committed Apr 16, 2012
Showing with 15 additions and 8 deletions.
  1. +3 −0 lib/workflow-in-memory-backend.js
  2. +12 −8 test/in-memory-backend.test.js
@@ -377,6 +377,9 @@ Backend.prototype.registerRunner = function (
callback = active_at;
active_at = new Date();
}
+ if (typeof (active_at) === 'string') {
+ active_at = new Date(active_at);
+ }
self.runners[runner_id] = {
runner_id: runner_id,
active_at: active_at,
@@ -298,21 +298,25 @@ test('re queue job', function (t) {
test('register runner', function (t) {
var d = new Date();
- backend.registerRunner(runnerId, function (err) {
- t.ifError(err, 'register runner error');
- backend.getRunner(runnerId, function (err, res) {
- t.ifError(err, 'get runner error');
- t.ok(util.isDate(res), 'runner active at');
- t.ok((res.getTime() >= d.getTime()), 'runner timestamp');
- t.end();
+ t.test('without specific time', function (t) {
+ backend.registerRunner(runnerId, function (err) {
+ t.ifError(err, 'register runner error');
+ backend.getRunner(runnerId, function (err, res) {
+ t.ifError(err, 'get runner error');
+ t.ok(util.isDate(res), 'runner active at');
+ t.ok((res.getTime() >= d.getTime()), 'runner timestamp');
+ t.end();
+ });
});
});
t.test('with specific time', function (t) {
backend.registerRunner(runnerId, d.toISOString(), function (err) {
t.ifError(err, 'register runner error');
backend.getRunner(runnerId, function (err, timestamp) {
t.ifError(err, 'backend get runner error');
- t.equal(d.toISOString(), timestamp);
+ console.log(typeof (d));
+ console.log(typeof (timestamp));
+ t.equivalent(d, timestamp);
t.end();
});
});

0 comments on commit d96f3a9

Please sign in to comment.