tests: fix for appendRevision test

pull/5853/head
webzwo0i 2023-07-29 21:21:06 +02:00
parent 4cf1be966d
commit cd6da7335b
2 changed files with 26 additions and 18 deletions

View File

@ -49,24 +49,6 @@ describe(__filename, function () {
});
});
describe('createPad with empty text', () => {
it('creates a new Pad with empty text', function (done) {
agent.get(`${endPoint('createPad')}&padID=${padID}&text=`)
.expect((res) => {
if (res.body.code !== 0) throw new Error('Unable to create new Pad');
})
.expect('Content-Type', /json/)
.expect(200);
agent.get(`${endPoint('deletePad')}&padID=${padID}`)
.expect((res) => {
if (res.body.code !== 0) throw new Error('Unable to delete empty Pad');
})
.expect('Content-Type', /json/)
.expect(200, done);
});
});
describe('createAuthor', function () {
it('Creates an author with a name set', function (done) {
agent.get(endPoint('createAuthor'))

View File

@ -17,6 +17,7 @@ let apiVersion = 1;
const testPadId = makeid();
const newPadId = makeid();
const copiedPadId = makeid();
const anotherPadId = makeid();
let lastEdited = '';
const text = generateLongText();
@ -502,6 +503,31 @@ describe(__filename, function () {
.expect('Content-Type', /json/);
assert.equal(res.body.data.revisions, revCount);
});
it('creates a new Pad with empty text', async function () {
await agent.get(`${endPoint('createPad')}&padID=${anotherPadId}&text=`)
.expect('Content-Type', /json/)
.expect(200)
.expect((res) => {
assert.equal(res.body.code, 0, 'Unable to create new Pad');
});
await agent.get(`${endPoint('getText')}&padID=${anotherPadId}`)
.expect('Content-Type', /json/)
.expect(200)
.expect((res) => {
assert.equal(res.body.code, 0, 'Unable to get pad text');
assert.equal(res.body.data.text, '\n', 'Pad text is not empty');
});
});
it('deletes with empty text', async function () {
await agent.get(`${endPoint('deletePad')}&padID=${anotherPadId}`)
.expect('Content-Type', /json/)
.expect(200)
.expect((res) => {
assert.equal(res.body.code, 0, 'Unable to delete empty Pad');
});
});
});
describe('copyPadWithoutHistory', function () {