more config.fqdn() removal in tests

This commit is contained in:
Girish Ramakrishnan
2018-01-24 14:58:37 -08:00
parent 45456f2cf7
commit ee66893875
10 changed files with 47 additions and 73 deletions

View File

@@ -15,6 +15,7 @@ var config = require('../config.js'),
server = require('../server.js');
var SERVER_URL = 'http://localhost:' + config.get('port');
var DOMAIN = 'example-server-test.com';
function cleanup(done) {
done();
@@ -25,7 +26,7 @@ describe('Server', function () {
before(function () {
config._reset();
config.setFqdn('example-server-test.com');
config.setFqdn(DOMAIN);
config.set('provider', 'notcaas'); // otherwise, cron sets a caas timer for heartbeat causing the test to not quit
});
@@ -252,28 +253,4 @@ describe('Server', function () {
});
});
});
describe('heartbeat', function () {
var successfulHeartbeatGet;
before(function (done) {
server.start(done);
var scope = nock(config.apiServerOrigin());
successfulHeartbeatGet = scope.get('/api/v1/boxes/' + config.fqdn() + '/heartbeat');
successfulHeartbeatGet.reply(200);
});
after(function (done) {
server.stop(done);
nock.cleanAll();
});
it('sends heartbeat', function (done) {
setTimeout(function () {
expect(successfulHeartbeatGet.counter).to.equal(1);
done();
}, 100);
});
});
});