tests: Delete erroneous `describe()` calls

`describe()` is meant to be used by independent tests, but the tests
in this file are not independent. Add a higher-level `describe()` call
and delete all of the `describe()` calls that wrap a single test.
pull/4685/head
Richard Hansen 2021-01-24 01:29:24 -05:00 committed by John McLear
parent 32a0df4883
commit dd815892f2
1 changed files with 12 additions and 18 deletions

View File

@ -227,15 +227,15 @@ const testImports = {
describe(__filename, function () { describe(__filename, function () {
Object.keys(testImports).forEach((testName) => { Object.keys(testImports).forEach((testName) => {
const testPadId = makeid(); describe(testName, function () {
const test = testImports[testName]; const testPadId = makeid();
if (test.disabled) { const test = testImports[testName];
return xit(`DISABLED: ${testName}`, function (done) { if (test.disabled) {
done(); return xit(`DISABLED: ${testName}`, function (done) {
}); done();
} });
describe(`createPad ${testName}`, function () { }
it('creates a new Pad', function (done) { it('createPad', function (done) {
api.get(`${endPoint('createPad')}&padID=${testPadId}`) api.get(`${endPoint('createPad')}&padID=${testPadId}`)
.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');
@ -243,10 +243,8 @@ describe(__filename, function () {
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200, done); .expect(200, done);
}); });
});
describe(`setHTML ${testName}`, function () { it('setHTML', function (done) {
it('Sets the HTML', function (done) {
api.get(`${endPoint('setHTML')}&padID=${testPadId}&html=${encodeURIComponent(test.input)}`) api.get(`${endPoint('setHTML')}&padID=${testPadId}&html=${encodeURIComponent(test.input)}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error(`Error:${testName}`); if (res.body.code !== 0) throw new Error(`Error:${testName}`);
@ -254,10 +252,8 @@ describe(__filename, function () {
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200, done); .expect(200, done);
}); });
});
describe(`getHTML ${testName}`, function () { it('getHTML', function (done) {
it('Gets back the HTML of a Pad', function (done) {
api.get(`${endPoint('getHTML')}&padID=${testPadId}`) api.get(`${endPoint('getHTML')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
const receivedHtml = res.body.data.html; const receivedHtml = res.body.data.html;
@ -279,10 +275,8 @@ describe(__filename, function () {
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200, done); .expect(200, done);
}); });
});
describe(`getText ${testName}`, function () { it('getText', function (done) {
it('Gets back the Text of a Pad', function (done) {
api.get(`${endPoint('getText')}&padID=${testPadId}`) api.get(`${endPoint('getText')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
const receivedText = res.body.data.text; const receivedText = res.body.data.text;