Message:
Expected { message : 'Failed to connect to .\SQLEXPRESS:1433 - getaddrinfo ENOTFOUND .\SQLEXPRESS', code : 'ESOCKET' } to be null.
Stacktrace:
Error: Expected { message : 'Failed to connect to .\SQLEXPRESS:1433 - getaddrinfo ENOTFOUND .\SQLEXPRESS', code : 'ESOCKET' } to be null.
at Connection.<anonymous> (D:\SelfLearning\NodeJSTraining\MVCNodeJSExample\tests\mssql.spec.js:14:25)
at emitOne (events.js:116:13)
at Connection.emit (events.js:211:7)
at Connection.socketError (D:\SelfLearning\NodeJSTraining\MVCNodeJSExample\node_modules\tedious\lib\connection.js:875:14)
at D:\SelfLearning\NodeJSTraining\MVCNodeJSExample\node_modules\tedious\lib\connection.js:740:25
at GetAddrInfoReqWrap.callback (D:\SelfLearning\NodeJSTraining\MVCNodeJSExample\node_modules\tedious\lib\connector.js:68:18)
at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:104:17)
and my test code like below
describe("MSSQL", function() {
it("is there a server running", function(next) {
var MSSQLClient = require('tedious').Connection
var config = {
userName: 'sa',
password: '*********',
server: '.\\SQLEXPRESS',
options: {
database: 'BootcampDB'
}
}
var connection = new MSSQLClient(config)
connection.on('connect', function(err) {
expect(err).toBe(null)
next()
})
})