Skip to content

Instantly share code, notes, and snippets.

@cjohansen
Forked from megoth/gist:2635085
Created May 8, 2012 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjohansen/2638282 to your computer and use it in GitHub Desktop.
Save cjohansen/2638282 to your computer and use it in GitHub Desktop.
Graphite graph - Testing .size with done(function () { ... });
define([
"src/graphite/graph",
"src/graphite/dictionary",
"src/graphite/query",
"src/graphite/utils",
"src/graphite/when"
], function (Graph, Dictionary, Query, Utils, When) {
buster.testCase("Graphite graph", {
...
"Function .size": function (done) {
var promises = [];
promises.push(this.g.size());
this.g.addStatement(this.subJohn, this.preName, this.objJohnName);
promises.push(this.g.size());
this.g.addStatement(this.subJohn, this.preKnows, this.subTim);
promises.push(this.g.size());
this.g.addStatement(this.subJohn, this.preKnows, this.subTim);
promises.push(this.g.size());
When.all(promises).then(done(function (results) {
assert.equals(results[0], 0);
assert.equals(results[1], 1);
assert.equals(results[2], 2);
assert.equals(results[3], 2);
}));
},
...
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment