From e22528aca6eb58c8f8005790ac6e76ed4f8ad706 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 10 Mar 2017 11:32:39 +0100 Subject: Server: add config endpoint --- server/tests/api/config.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++ server/tests/api/index.js | 1 + 2 files changed, 54 insertions(+) create mode 100644 server/tests/api/config.js (limited to 'server/tests/api') diff --git a/server/tests/api/config.js b/server/tests/api/config.js new file mode 100644 index 000000000..08f955f2d --- /dev/null +++ b/server/tests/api/config.js @@ -0,0 +1,53 @@ +/* eslint-disable no-unused-expressions */ + +'use strict' + +const chai = require('chai') +const expect = chai.expect +const series = require('async/series') + +const serversUtils = require('../utils/servers') +const configUtils = require('../utils/config') + +describe('Test config', function () { + let server = null + + before(function (done) { + this.timeout(20000) + + series([ + function (next) { + serversUtils.flushTests(next) + }, + function (next) { + serversUtils.runServer(1, function (server1) { + server = server1 + next() + }) + } + ], done) + }) + + it('Should have a correct config', function (done) { + configUtils.getConfig(server.url, function (err, res) { + if (err) throw err + + const data = res.body + + expect(data.signup.enabled).to.be.truthy + + done() + }) + }) + + after(function (done) { + process.kill(-server.app.pid) + + // Keep the logs if the test failed + if (this.ok) { + serversUtils.flushTests(done) + } else { + done() + } + }) +}) diff --git a/server/tests/api/index.js b/server/tests/api/index.js index 11f49e1e2..dc6ef92ab 100644 --- a/server/tests/api/index.js +++ b/server/tests/api/index.js @@ -1,6 +1,7 @@ 'use strict' // Order of the tests we want to execute +require('./config') require('./check-params') require('./friends-basic') require('./users') -- cgit v1.2.3