Loading comments/comments.js +2 −2 Original line number Diff line number Diff line Loading @@ -19,8 +19,8 @@ module.exports = (function(){ Comments.prototype = { /** * Finds a single comment by ID. * Excludes deleted comments. * Finds a single comment by ID in the current domain. * Does not fine deleted comments. * * @param {Number} id The ID of the comment to find. * @param {Function} callback Called with the result. Loading comments/comments.spec.js +28 −1 Original line number Diff line number Diff line Loading @@ -54,6 +54,20 @@ describe("Comments", function() { }); }); it("#find returns empty array when target not found", function(done) { comments.find({type: "class", cls: "Foo", member: "bar"}, function(rows) { expect(rows.length).toEqual(0); done(); }); }); it("#find returns empty array when target not in current domain", function(done) { comments.find({type: "guide", cls: "forms", member: ""}, function(rows) { expect(rows.length).toEqual(0); done(); }); }); it("#findRecent returns n recent comments", function(done) { comments.findRecent({limit: 10, offset: 0}, function(rows) { expect(rows.length).toEqual(10); Loading @@ -75,13 +89,26 @@ describe("Comments", function() { }); }); it("#count gets total number of comments", function(done) { it("#count gets total number of comments in current domain", function(done) { comments.count({}, function(cnt) { expect(cnt).toEqual(24); done(); }); }); describe("when initializing Comments to other domain", function() { beforeEach(function() { comments = new Comments(connection, "touch-2"); }); it("#count gets total number of comments in the other domain", function(done) { comments.count({}, function(cnt) { expect(cnt).toEqual(4); done(); }); }); }); it("#countPerTarget gets number of comments for each target", function(done) { comments.countsPerTarget(function(counts) { expect(counts["class__Ext__"]).toEqual(5); Loading Loading
comments/comments.js +2 −2 Original line number Diff line number Diff line Loading @@ -19,8 +19,8 @@ module.exports = (function(){ Comments.prototype = { /** * Finds a single comment by ID. * Excludes deleted comments. * Finds a single comment by ID in the current domain. * Does not fine deleted comments. * * @param {Number} id The ID of the comment to find. * @param {Function} callback Called with the result. Loading
comments/comments.spec.js +28 −1 Original line number Diff line number Diff line Loading @@ -54,6 +54,20 @@ describe("Comments", function() { }); }); it("#find returns empty array when target not found", function(done) { comments.find({type: "class", cls: "Foo", member: "bar"}, function(rows) { expect(rows.length).toEqual(0); done(); }); }); it("#find returns empty array when target not in current domain", function(done) { comments.find({type: "guide", cls: "forms", member: ""}, function(rows) { expect(rows.length).toEqual(0); done(); }); }); it("#findRecent returns n recent comments", function(done) { comments.findRecent({limit: 10, offset: 0}, function(rows) { expect(rows.length).toEqual(10); Loading @@ -75,13 +89,26 @@ describe("Comments", function() { }); }); it("#count gets total number of comments", function(done) { it("#count gets total number of comments in current domain", function(done) { comments.count({}, function(cnt) { expect(cnt).toEqual(24); done(); }); }); describe("when initializing Comments to other domain", function() { beforeEach(function() { comments = new Comments(connection, "touch-2"); }); it("#count gets total number of comments in the other domain", function(done) { comments.count({}, function(cnt) { expect(cnt).toEqual(4); done(); }); }); }); it("#countPerTarget gets number of comments for each target", function(done) { comments.countsPerTarget(function(counts) { expect(counts["class__Ext__"]).toEqual(5); Loading