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