2019-02-24 20:37:11 +03:00
|
|
|
const should = require('should');
|
|
|
|
const supertest = require('supertest');
|
2019-09-20 18:02:45 +03:00
|
|
|
const testUtils = require('../../utils');
|
2019-02-24 20:37:11 +03:00
|
|
|
const localUtils = require('./utils');
|
2020-05-27 20:47:53 +03:00
|
|
|
const config = require('../../../core/shared/config');
|
2019-02-24 20:37:11 +03:00
|
|
|
const ghost = testUtils.startGhost;
|
|
|
|
|
|
|
|
let request;
|
|
|
|
|
|
|
|
describe('Config API', function () {
|
|
|
|
before(function () {
|
|
|
|
return ghost()
|
|
|
|
.then(function () {
|
|
|
|
request = supertest.agent(config.get('url'));
|
|
|
|
})
|
|
|
|
.then(function () {
|
|
|
|
return localUtils.doAuth(request);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can retrieve config and all expected properties', function () {
|
|
|
|
return request
|
|
|
|
.get(localUtils.API.getApiQuery('config/'))
|
|
|
|
.set('Origin', config.get('url'))
|
|
|
|
.expect('Content-Type', /json/)
|
|
|
|
.expect('Cache-Control', testUtils.cacheRules.private)
|
|
|
|
.expect(200)
|
|
|
|
.then((res) => {
|
2019-02-25 01:28:09 +03:00
|
|
|
localUtils.API.checkResponse(res.body.config, 'config');
|
2019-02-24 20:37:11 +03:00
|
|
|
|
|
|
|
// full version
|
2019-02-25 01:28:09 +03:00
|
|
|
res.body.config.version.should.match(/\d+\.\d+\.\d+/);
|
2019-02-24 20:37:11 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|