failing test for the elusive milisecond parsing bug

This commit is contained in:
Brian Carlson 2011-01-23 22:19:55 -06:00
parent 75b369f25a
commit 2e3dee254f
3 changed files with 18 additions and 3 deletions

View File

@ -107,6 +107,7 @@ test("timestampz round trip", function() {
text: 'select * from date_tests where name = $1',
values: ['now']
});
client.connection.on('dataRow', console.log);
assert.emits(result, 'row', function(row) {
var date = row.tstz;
assert.equal(date.getYear(),now.getYear());
@ -118,7 +119,6 @@ test("timestampz round trip", function() {
test("milliseconds are equal", function() {
assert.equal(date.getMilliseconds(), now.getMilliseconds());
});
});
client.on('drain', client.end.bind(client));

View File

@ -2,10 +2,18 @@ var helper = require(__dirname + '/test-helper');
var q = require('query')
test("testing dateParser", function() {
assert.equal(q.dateParser("2010-12-11 09:09:04").toUTCString(),new Date("2010-12-11 09:09:04 GMT").toUTCString());
assert.equal(q.dateParser("2010-12-11 09:09:04").toUTCString(),new Date("2010-12-11 09:09:04 GMT").toUTCString());
});
test("testing 2dateParser", function() {
assert.equal(JSON.stringify(q.dateParser("2010-12-11 09:09:04.19")),"\"2010-12-11T09:09:04.190Z\"");
var actual = "2010-12-11 09:09:04.19";
var expected = "\"2010-12-11T09:09:04.190Z\"";
assert.equal(JSON.stringify(q.dateParser(actual)),expected);
});
test("testing 2dateParser", function() {
var actual = "2011-01-23 22:15:51.28-06";
var expected = "\"2011-01-24T04:15:51.280Z\"";
assert.equal(JSON.stringify(q.dateParser(actual)),expected);
});

View File

@ -71,6 +71,13 @@ test('typed results', function() {
assert.UTCDate(val, 2010, 9, 31, 20, 24, 13, 74);
}
},{
name: 'timestamptz with other milisecond digits dropped',
dataTypeID: 1184,
actual: '2011-01-23 22:05:00.68-06',
expected: function(val) {
assert.UTCDate(val, 2011, 01, 24, 4, 5, 00, 68);
}
}, {
name: 'timestampz with huge miliseconds in UTC',
dataTypeID: 1184,
actual: '2010-10-30 14:11:12.730838Z',