IbuildingsItaly / sails-db2

MIT License
10 stars 12 forks source link

Update tearDown method to match ibm_db api for connection close #14

Closed gggordon closed 7 years ago

gggordon commented 9 years ago

tearDown method currently gives errors when closing connection since it is looking for method close on connection["conn"].

Preview of mocha tests using sails-test-builder of models using sails-db2 adapter

  "after all" hook for "should be successful":
     TypeError: Cannot read property 'conn' of undefined
      at closeConnection (C:\wamp\www\2015\hackathon\zhecko\node_modules\sails-d
b2\index.js:224:31)
      at forOwn (C:\wamp\www\2015\hackathon\zhecko\node_modules\sails-db2\node_m
odules\lodash\dist\lodash.js:2106:15)
      at Function.forEach (C:\wamp\www\2015\hackathon\zhecko\node_modules\sails-
db2\node_modules\lodash\dist\lodash.js:3303:9)
      at Object.module.exports.adapter.teardown (C:\wamp\www\2015\hackathon\zhec
ko\node_modules\sails-db2\index.js:232:20)
      at C:\wamp\www\2015\hackathon\zhecko\node_modules\sails\lib\hooks\orm\inde
x.js:244:19
      at C:\wamp\www\2015\hackathon\zhecko\node_modules\sails\node_modules\async
\lib\async.js:122:13
      at _each (C:\wamp\www\2015\hackathon\zhecko\node_modules\sails\node_module
s\async\lib\async.js:46:13)
      at Object.async.each (C:\wamp\www\2015\hackathon\zhecko\node_modules\sails
\node_modules\async\lib\async.js:121:9)
      at Sails.hook.teardown (C:\wamp\www\2015\hackathon\zhecko\node_modules\sai
ls\lib\hooks\orm\index.js:241:13)
      at Sails.emitter.emit (C:\wamp\www\2015\hackathon\zhecko\node_modules\sail
s\lib\app\private\after.js:50:11)
      at C:\wamp\www\2015\hackathon\zhecko\node_modules\sails\lib\app\lower.js:6
0:11
      at beforeShutdown (C:\wamp\www\2015\hackathon\zhecko\node_modules\sails\li
b\app\lower.js:35:12)
      at Sails.lower (C:\wamp\www\2015\hackathon\zhecko\node_modules\sails\lib\a
pp\lower.js:39:3)
      at Sails.bound (C:\wamp\www\2015\hackathon\zhecko\node_modules\sails\node_
modules\lodash\dist\lodash.js:729:21)
      at C:\wamp\www\2015\hackathon\zhecko\node_modules\sails-test-helper\lib\bo
otstrap.js:30:9
      at C:\wamp\www\2015\hackathon\zhecko\node_modules\sails-test-helper\node_m
odules\node-test-helper\lib\global.js:139:7
      at C:\wamp\www\2015\hackathon\zhecko\node_modules\sails-test-helper\node_m
odules\node-test-helper\node_modules\async\lib\async.js:187:20
      at iterate (C:\wamp\www\2015\hackathon\zhecko\node_modules\sails-test-help
er\node_modules\node-test-helper\node_modules\async\lib\async.js:265:13)
      at Object.async.forEachOfSeries.async.eachOfSeries (C:\wamp\www\2015\hacka
thon\zhecko\node_modules\sails-test-helper\node_modules\node-test-helper\node_mo
dules\async\lib\async.js:284:9)
      at Object.async.forEachSeries.async.eachSeries (C:\wamp\www\2015\hackathon
\zhecko\node_modules\sails-test-helper\node_modules\node-test-helper\node_module
s\async\lib\async.js:220:22)
      at Function.afterAll.exec (C:\wamp\www\2015\hackathon\zhecko\node_modules\
sails-test-helper\node_modules\node-test-helper\lib\global.js:137:9)
      at Context.<anonymous> (C:\wamp\www\2015\hackathon\zhecko\node_modules\sai
ls-test-helper\node_modules\node-test-helper\lib\after.js:9:12)
      at callFnAsync (C:\Users\Psmt1\AppData\Roaming\npm\node_modules\mocha\lib\
runnable.js:306:8)
      at Hook.Runnable.run (C:\Users\Psmt1\AppData\Roaming\npm\node_modules\moch
a\lib\runnable.js:261:7)
      at next (C:\Users\Psmt1\AppData\Roaming\npm\node_modules\mocha\lib\runner.
js:297:10)
      at Immediate._onImmediate (C:\Users\Psmt1\AppData\Roaming\npm\node_modules
\mocha\lib\runner.js:319:5)