Skip to content

Node.js based forum software built for the modern web

additional tests for post diffs privilege checking

Julian Lam8e832abf1e33
diff --git a/test/posts.js b/test/posts.js
index 6401d35bc0..f715f22274 100644
--- a/test/posts.js
+++ b/test/posts.js
@@ -461,6 +461,22 @@ describe('Post\'s', function () {
done();
});
});
+
+ it('should not allow guests to view diffs', function (done) {
+ socketPosts.getDiffs({ uid: 0 }, { pid: 1 }, function (err) {
+ assert.equal(err.message, '[[error:no-privileges]]');
+ done();
+ });
+ });
+
+ it('should allow registered-users group to view diffs', function (done) {
+ socketPosts.getDiffs({ uid: 1 }, { pid: 1 }, function (err, timestamps) {
+ assert.ifError(err);
+ assert.equal(true, Array.isArray(timestamps));
+ assert.strictEqual(1, timestamps.length);
+ done();
+ });
+ });
});
describe('move', function () {