tests: fix for appendRevision test
parent
4cf1be966d
commit
cd6da7335b
|
@ -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 () {
|
describe('createAuthor', function () {
|
||||||
it('Creates an author with a name set', function (done) {
|
it('Creates an author with a name set', function (done) {
|
||||||
agent.get(endPoint('createAuthor'))
|
agent.get(endPoint('createAuthor'))
|
||||||
|
|
|
@ -17,6 +17,7 @@ let apiVersion = 1;
|
||||||
const testPadId = makeid();
|
const testPadId = makeid();
|
||||||
const newPadId = makeid();
|
const newPadId = makeid();
|
||||||
const copiedPadId = makeid();
|
const copiedPadId = makeid();
|
||||||
|
const anotherPadId = makeid();
|
||||||
let lastEdited = '';
|
let lastEdited = '';
|
||||||
const text = generateLongText();
|
const text = generateLongText();
|
||||||
|
|
||||||
|
@ -502,6 +503,31 @@ describe(__filename, function () {
|
||||||
.expect('Content-Type', /json/);
|
.expect('Content-Type', /json/);
|
||||||
assert.equal(res.body.data.revisions, revCount);
|
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 () {
|
describe('copyPadWithoutHistory', function () {
|
||||||
|
|
Loading…
Reference in New Issue