Windshaft-cartodb/test/unit/error-messages-test.js

25 lines
890 B
JavaScript
Raw Normal View History

'use strict';
2019-10-07 17:29:07 +08:00
require('../support/test-helper');
var assert = require('assert');
2019-10-07 17:29:07 +08:00
var errorMiddleware = require('../../lib/api/middlewares/error-middleware');
2019-10-22 01:07:24 +08:00
describe('error messages clean up', function () {
// See https://github.com/CartoDB/Windshaft/issues/173
2019-10-22 01:07:24 +08:00
it('#173 does not send db details in connection error response', function () {
var inMessage = [
2019-10-22 01:07:24 +08:00
'Postgis Plugin: Bad connection',
"Connection string: 'host=127.0.0.1 port=5432 dbname=test_windshaft_cartodb_user_1_db " +
"user=test_windshaft_cartodb_user_1 connect_timeout=4'",
" encountered during parsing of layer 'layer0' in Layer"
].join('\n');
var outMessage = errorMiddleware.errorMessage(inMessage);
assert.ok(outMessage.match('connect'), outMessage);
assert.ok(!outMessage.match(/666/), outMessage);
});
});