diff --git a/src/tests/backend/specs/api/api.js b/src/tests/backend/specs/api/api.js index 54ba61cd2..665dd04e7 100644 --- a/src/tests/backend/specs/api/api.js +++ b/src/tests/backend/specs/api/api.js @@ -32,45 +32,39 @@ const testPadId = makeid(); const endPoint = (point) => `/api/${apiVersion}/${point}?apikey=${apiKey}`; describe(__filename, function () { - describe('API Versioning', function () { - it('errors if can not connect', function (done) { - api - .get('/api/') - .expect((res) => { - apiVersion = res.body.currentVersion; - if (!res.body.currentVersion) throw new Error('No version set in API'); - return; - }) - .expect(200, done); - }); + it('can obtain API version', function (done) { + api + .get('/api/') + .expect((res) => { + apiVersion = res.body.currentVersion; + if (!res.body.currentVersion) throw new Error('No version set in API'); + return; + }) + .expect(200, done); }); - describe('OpenAPI definition', function () { - it('generates valid openapi definition document', function (done) { - api - .get('/api/openapi.json') - .expect((res) => { - const {valid, errors} = validateOpenAPI(res.body, 3); - if (!valid) { - const prettyErrors = JSON.stringify(errors, null, 2); - throw new Error(`Document is not valid OpenAPI. ${errors.length} ` + - `validation errors:\n${prettyErrors}`); - } - return; - }) - .expect(200, done); - }); + it('can obtain valid openapi definition document', function (done) { + api + .get('/api/openapi.json') + .expect((res) => { + const {valid, errors} = validateOpenAPI(res.body, 3); + if (!valid) { + const prettyErrors = JSON.stringify(errors, null, 2); + throw new Error(`Document is not valid OpenAPI. ${errors.length} ` + + `validation errors:\n${prettyErrors}`); + } + return; + }) + .expect(200, done); }); - describe('jsonp support', function () { - it('supports jsonp calls', function (done) { - api - .get(`${endPoint('createPad')}&jsonp=jsonp_1&padID=${testPadId}`) - .expect((res) => { - if (!res.text.match('jsonp_1')) throw new Error('no jsonp call seen'); - }) - .expect('Content-Type', /javascript/) - .expect(200, done); - }); + it('supports jsonp calls', function (done) { + api + .get(`${endPoint('createPad')}&jsonp=jsonp_1&padID=${testPadId}`) + .expect((res) => { + if (!res.text.match('jsonp_1')) throw new Error('no jsonp call seen'); + }) + .expect('Content-Type', /javascript/) + .expect(200, done); }); });