From 8e832abf1e3313455fbeb0bdbb70a2ffe744e509 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 8 Jun 2018 11:52:25 -0400 Subject: [PATCH] additional tests for post diffs privilege checking --- test/posts.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 () {