Skip to content

Commit 63de249

Browse files
webzwo0irhansen
authored andcommitted
tests: do not re-add identical text with setText
1 parent 668d62f commit 63de249

File tree

1 file changed

+29
-0
lines changed
  • src/tests/backend/specs/api

1 file changed

+29
-0
lines changed

src/tests/backend/specs/api/pad.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,35 @@ describe(__filename, function () {
461461
.expect('Content-Type', /json/);
462462
assert.equal(res.body.code, 0);
463463
});
464+
465+
it('does not add an useless revision', async function () {
466+
let res = await agent.post(`${endPoint('setText')}&padID=${testPadId}`)
467+
.field({text: 'identical text\n'})
468+
.expect(200)
469+
.expect('Content-Type', /json/);
470+
assert.equal(res.body.code, 0);
471+
472+
res = await agent.get(`${endPoint('getText')}&padID=${testPadId}`)
473+
.expect(200)
474+
.expect('Content-Type', /json/);
475+
assert.equal(res.body.data.text, 'identical text\n');
476+
477+
res = await agent.get(`${endPoint('getRevisionsCount')}&padID=${testPadId}`)
478+
.expect(200)
479+
.expect('Content-Type', /json/);
480+
const revCount = res.body.data.revisions;
481+
482+
res = await agent.post(`${endPoint('setText')}&padID=${testPadId}`)
483+
.field({text: 'identical text\n'})
484+
.expect(200)
485+
.expect('Content-Type', /json/);
486+
assert.equal(res.body.code, 0);
487+
488+
res = await agent.get(`${endPoint('getRevisionsCount')}&padID=${testPadId}`)
489+
.expect(200)
490+
.expect('Content-Type', /json/);
491+
assert.equal(res.body.data.revisions, revCount);
492+
});
464493
});
465494

466495
describe('copyPadWithoutHistory', function () {

0 commit comments

Comments
 (0)