cloudron-e2e-test/common.js

27 lines
671 B
JavaScript
Raw Normal View History

2015-06-17 02:13:17 +00:00
'use strict';
2015-06-20 18:49:12 +00:00
var path = require('path');
2015-06-17 02:13:17 +00:00
exports = module.exports = {
TESTAPP_ID: 'io.cloudron.testapp',
2015-06-20 18:47:59 +00:00
TESTAPP_VERSION : '1.0.2',
2015-06-19 20:06:00 +00:00
cloudronDomain: cloudronDomain,
verifyResponse: verifyResponse
2015-06-17 02:13:17 +00:00
};
2015-06-19 20:06:00 +00:00
function cloudronDomain(filename) {
var r = (Math.random() * 1000).toFixed();
return 't-' + path.basename(filename, '-test.js') + '-' + r + '.smartserver.io';
}
function verifyResponse(res, errorMessage) {
if (res.statusCode < 200 || res.statusCode > 299) {
console.log('Response error statusCode:%s error:%s body:%s', res.statusCode, res.error, res.body);
console.log(errorMessage.red);
process.exit(1);
}
}