Skip to content
Browse files

Moving to pit test system

  • Loading branch information...
1 parent 5698e48 commit c6eec74dfef999c91b228c2d535b4cadec44dcd5 @akaspin committed
Showing with 9 additions and 15 deletions.
  1. +4 −6 test/common.js
  2. +5 −9 test/test-cache.js
View
10 test/common.js
@@ -1,10 +1,12 @@
var fs = require("fs");
var path = require("path");
var assert = require("assert");
+var pit = require("./run.js");
var nun = exports.nun = require("../");
-var ended = false;
+pit.expect("ended", 1);
+
exports.test = function(name, context, options, callback) {
function file(name) {
@@ -36,12 +38,8 @@ exports.test = function(name, context, options, callback) {
output
.addListener('data', function(data){ buffer += data; })
.addListener('end', function(){
- ended = true;
+ pit.mark("ended");
assertFile(buffer, name);
});
});
};
-
-process.on("exit", function () {
- assert.ok(ended);
-});
View
14 test/test-cache.js
@@ -1,8 +1,8 @@
-var assert = require("assert");
+var pit = require("./run");
var cache = require("../cache");
-var renders = 0;
-var gets = 0;
+pit.expect("renders", 4);
+pit.expect("gets", 4000);
for (var i = 0; i < 4; i++) {
var key = i.toString();
@@ -10,19 +10,15 @@ for (var i = 0; i < 4; i++) {
cache.operate(key,
function(value) {
if (value == key) {
- gets++;
+ pit.mark("gets");
}
},
function(callback) {
setTimeout(function(){
- renders++;
+ pit.mark("renders");
callback(key);
}, 200);
});
}
}
-process.addListener("exit", function () {
- assert.equal(renders, 4);
- assert.equal(gets, 4000);
-});

0 comments on commit c6eec74

Please sign in to comment.
Something went wrong with that request. Please try again.