Permalink
Browse files

[test] Test `checkProcess`

  • Loading branch information...
1 parent c17d004 commit 684296ae614a41f325d85acba3a3ddfa65df5bfe @mmalecki mmalecki committed with Oct 10, 2011
Showing with 19 additions and 0 deletions.
  1. +19 −0 test/forever-test.js
View
@@ -88,6 +88,25 @@ vows.describe('forever').addBatch({
assert.isNotNull(err);
assert.isTrue(err.message.indexOf('does not exist') !== -1);
}
+ },
+ "checking if process exists": {
+ "if process process exists": {
+ topic: forever.checkProcess(process.pid),
+ "should return true": function (result) {
+ assert.isTrue(result);
+ }
+ },
+ "if process doesn't exist": {
+ topic: forever.checkProcess(255 * 255 * 255),
+ //
+ // This is insanely large value. On most systems there'll be no process
+ // with such PID. Also, there's no multiplatform way to check for
+ // PID limit.
+ //
+ "should return false": function (result) {
+ assert.isFalse(result);
+ }
+ }
}
}
}).export(module);

0 comments on commit 684296a

Please sign in to comment.