mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-01 00:27:50 +02:00
2 diff test
This commit is contained in:
@@ -23,7 +23,9 @@ Diffs.exists = function (pid, callback) {
|
||||
|
||||
Diffs.get = function (pid, since, callback) {
|
||||
async.waterfall([
|
||||
async.apply(db.getListRange.bind(db), 'post:' + pid + ':diffs', 0, -1),
|
||||
function (next) {
|
||||
Diffs.list(pid, next);
|
||||
},
|
||||
function (timestamps, next) {
|
||||
// Pass those made after `since`, and create keys
|
||||
const keys = timestamps.filter(function (timestamp) {
|
||||
|
||||
@@ -443,6 +443,24 @@ describe('Post\'s', function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return diffs', function (done) {
|
||||
posts.diffs.get(replyPid, 0, function (err, data) {
|
||||
assert.ifError(err);
|
||||
assert(Array.isArray(data));
|
||||
assert(data[0].pid, replyPid);
|
||||
assert(data[0].patch);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should load diffs and reconstruct post', function (done) {
|
||||
posts.diffs.load(replyPid, 0, voterUid, function (err, data) {
|
||||
assert.ifError(err);
|
||||
assert.equal(data.content, 'A reply to edit\n');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('move', function () {
|
||||
|
||||
Reference in New Issue
Block a user