This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
node-task/node_modules/mysql2/test/integration/connection/test-invalid-date-result.js

22 lines
525 B
JavaScript
Raw Normal View History

2014-09-24 17:56:53 -04:00
var common = require('../../common');
var connection = common.createConnection();
var assert = require('assert');
var rows = undefined;
connection.execute('SELECT TIMESTAMP(0000-00-00) t', [], function(err, _rows, _fields) {
if (err) throw err;
rows = _rows;
});
connection.end();
function isInvalidTime(t) {
return isNaN(t.getTime());
}
process.on('exit', function() {
assert.deepEqual(Object.prototype.toString.call(rows[0].t), "[object Date]");
assert.deepEqual(isInvalidTime(rows[0].t), true);
});