mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
tests: Promisify import/export tests
This commit is contained in:
parent
ff50682412
commit
98c42d6076
1 changed files with 22 additions and 21 deletions
|
@ -239,27 +239,30 @@ describe(__filename, function () {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
it('createPad', function (done) {
|
|
||||||
agent.get(`${endPoint('createPad')}&padID=${testPadId}`)
|
it('createPad', async function () {
|
||||||
|
await agent.get(`${endPoint('createPad')}&padID=${testPadId}`)
|
||||||
|
.expect(200)
|
||||||
|
.expect('Content-Type', /json/)
|
||||||
.expect((res) => {
|
.expect((res) => {
|
||||||
if (res.body.code !== 0) throw new Error('Unable to create new Pad');
|
if (res.body.code !== 0) throw new Error('Unable to create new Pad');
|
||||||
})
|
});
|
||||||
.expect('Content-Type', /json/)
|
|
||||||
.expect(200, done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('setHTML', function (done) {
|
it('setHTML', async function () {
|
||||||
agent.get(`${endPoint('setHTML')}&padID=${testPadId}` +
|
await agent.get(`${endPoint('setHTML')}&padID=${testPadId}` +
|
||||||
`&html=${encodeURIComponent(test.input)}`)
|
`&html=${encodeURIComponent(test.input)}`)
|
||||||
|
.expect(200)
|
||||||
|
.expect('Content-Type', /json/)
|
||||||
.expect((res) => {
|
.expect((res) => {
|
||||||
if (res.body.code !== 0) throw new Error(`Error:${testName}`);
|
if (res.body.code !== 0) throw new Error(`Error:${testName}`);
|
||||||
})
|
});
|
||||||
.expect('Content-Type', /json/)
|
|
||||||
.expect(200, done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('getHTML', function (done) {
|
it('getHTML', async function () {
|
||||||
agent.get(`${endPoint('getHTML')}&padID=${testPadId}`)
|
await agent.get(`${endPoint('getHTML')}&padID=${testPadId}`)
|
||||||
|
.expect(200)
|
||||||
|
.expect('Content-Type', /json/)
|
||||||
.expect((res) => {
|
.expect((res) => {
|
||||||
const gotHtml = res.body.data.html;
|
const gotHtml = res.body.data.html;
|
||||||
if (gotHtml !== test.wantHTML) {
|
if (gotHtml !== test.wantHTML) {
|
||||||
|
@ -276,13 +279,13 @@ describe(__filename, function () {
|
||||||
Which is a different version of the originally imported one:
|
Which is a different version of the originally imported one:
|
||||||
${test.input}`);
|
${test.input}`);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
.expect('Content-Type', /json/)
|
|
||||||
.expect(200, done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('getText', function (done) {
|
it('getText', async function () {
|
||||||
agent.get(`${endPoint('getText')}&padID=${testPadId}`)
|
await agent.get(`${endPoint('getText')}&padID=${testPadId}`)
|
||||||
|
.expect(200)
|
||||||
|
.expect('Content-Type', /json/)
|
||||||
.expect((res) => {
|
.expect((res) => {
|
||||||
const gotText = res.body.data.text;
|
const gotText = res.body.data.text;
|
||||||
if (gotText !== test.wantText) {
|
if (gotText !== test.wantText) {
|
||||||
|
@ -299,9 +302,7 @@ describe(__filename, function () {
|
||||||
Which is a different version of the originally imported one:
|
Which is a different version of the originally imported one:
|
||||||
${test.input}`);
|
${test.input}`);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
.expect('Content-Type', /json/)
|
|
||||||
.expect(200, done);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue