tests: do not re-add identical text with setText

pull/5252/head
webzwo0i 2021-10-29 00:53:36 +02:00 committed by Richard Hansen
parent 668d62fa3f
commit 63de249236
1 changed files with 29 additions and 0 deletions

View File

@ -461,6 +461,35 @@ describe(__filename, function () {
.expect('Content-Type', /json/);
assert.equal(res.body.code, 0);
});
it('does not add an useless revision', async function () {
let res = await agent.post(`${endPoint('setText')}&padID=${testPadId}`)
.field({text: 'identical text\n'})
.expect(200)
.expect('Content-Type', /json/);
assert.equal(res.body.code, 0);
res = await agent.get(`${endPoint('getText')}&padID=${testPadId}`)
.expect(200)
.expect('Content-Type', /json/);
assert.equal(res.body.data.text, 'identical text\n');
res = await agent.get(`${endPoint('getRevisionsCount')}&padID=${testPadId}`)
.expect(200)
.expect('Content-Type', /json/);
const revCount = res.body.data.revisions;
res = await agent.post(`${endPoint('setText')}&padID=${testPadId}`)
.field({text: 'identical text\n'})
.expect(200)
.expect('Content-Type', /json/);
assert.equal(res.body.code, 0);
res = await agent.get(`${endPoint('getRevisionsCount')}&padID=${testPadId}`)
.expect(200)
.expect('Content-Type', /json/);
assert.equal(res.body.data.revisions, revCount);
});
});
describe('copyPadWithoutHistory', function () {