Permalink
Browse files

added callback tester

  • Loading branch information...
1 parent b45faa6 commit 34037f899a499c05d6ce2aa83cd0e2e42035be11 @nip3o nip3o committed Apr 19, 2012
Showing with 28 additions and 8 deletions.
  1. +28 −8 src/testdriver/tests/DatabaseTests.js
@@ -3,9 +3,6 @@
var VALIDATE = false, TIMEOUT = 1000;
var gdb; // Global database variable
-var gcat; // Global category
-var gsub; // Global sub forum
-
var g = [];
/* Finishes a create-test with or without a validation-delay */
@@ -43,13 +40,13 @@ function checkListCallback(test, names, property, setGlobal) {
if (items.length != names.length) {
test.finish("Wrong number of objects recieved");
- list.close();
+// list.close();
return false;
}
for(n in items) {
if(names.indexOf(items[n][property]) == -1) {
- list.close();
+// list.close();
test.finish("Unexpected object name '" + items[n][property] + "'");
return false;
}
@@ -60,7 +57,7 @@ function checkListCallback(test, names, property, setGlobal) {
console.log(g[setGlobal]);
}
- list.close();
+// list.close();
test.finish();
}
}
@@ -105,7 +102,7 @@ enyo.kind({
Testcase x.x.3
Gets a list of database users
**/
- testGetUsers: function() {
+/* testGetUsers: function() {
var test = this;
var getall = function() {
gdb.getAllUsers(checkListCallback(test, ["otherUser", "testUser"], "name"), 2);
@@ -115,7 +112,7 @@ enyo.kind({
"otherUser"
);
},
-
+*/
/**
Testcase x.x.4
Gets a list of categories
@@ -238,4 +235,27 @@ enyo.kind({
checkListCallback(test, ["An answer"], "content"), g["post"], 1, 0
);
},
+
+ /**
+ Testcase x.x.10
+ Gets some posts
+ **/
+ testCallback: function() {
+ var test = this;
+
+ gdb.getThreads(
+ function(list) {
+ console.log("Mupp");
+ console.log(list);
+
+ }, g["subforum"], 1, 0
+ );
+
+ setTimeout(function() {
+ console.log("new!");
+ gdb.newThread(
+ function (e) { test.fail("Recieved error " + e); }, g["subforum"], "a", "b", "c"
+ );
+ }, 1000);
+ },
});

0 comments on commit 34037f8

Please sign in to comment.