Skip to content

Commit 2e3dee2

Browse files
committed
failing test for the elusive milisecond parsing bug
1 parent 75b369f commit 2e3dee2

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

test/integration/client/type-coercion-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ test("timestampz round trip", function() {
107107
text: 'select * from date_tests where name = $1',
108108
values: ['now']
109109
});
110+
client.connection.on('dataRow', console.log);
110111
assert.emits(result, 'row', function(row) {
111112
var date = row.tstz;
112113
assert.equal(date.getYear(),now.getYear());
@@ -118,7 +119,6 @@ test("timestampz round trip", function() {
118119
test("milliseconds are equal", function() {
119120
assert.equal(date.getMilliseconds(), now.getMilliseconds());
120121
});
121-
122122
});
123123

124124
client.on('drain', client.end.bind(client));

test/unit/client/query-tests.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@ var helper = require(__dirname + '/test-helper');
22
var q = require('query')
33

44
test("testing dateParser", function() {
5-
assert.equal(q.dateParser("2010-12-11 09:09:04").toUTCString(),new Date("2010-12-11 09:09:04 GMT").toUTCString());
5+
assert.equal(q.dateParser("2010-12-11 09:09:04").toUTCString(),new Date("2010-12-11 09:09:04 GMT").toUTCString());
66
});
77

88
test("testing 2dateParser", function() {
9-
assert.equal(JSON.stringify(q.dateParser("2010-12-11 09:09:04.19")),"\"2010-12-11T09:09:04.190Z\"");
9+
var actual = "2010-12-11 09:09:04.19";
10+
var expected = "\"2010-12-11T09:09:04.190Z\"";
11+
assert.equal(JSON.stringify(q.dateParser(actual)),expected);
12+
});
13+
14+
test("testing 2dateParser", function() {
15+
var actual = "2011-01-23 22:15:51.28-06";
16+
var expected = "\"2011-01-24T04:15:51.280Z\"";
17+
assert.equal(JSON.stringify(q.dateParser(actual)),expected);
1018
});
1119

test/unit/client/typed-query-results.js renamed to test/unit/client/typed-query-results-tests.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ test('typed results', function() {
7171
assert.UTCDate(val, 2010, 9, 31, 20, 24, 13, 74);
7272
}
7373
},{
74+
name: 'timestamptz with other milisecond digits dropped',
75+
dataTypeID: 1184,
76+
actual: '2011-01-23 22:05:00.68-06',
77+
expected: function(val) {
78+
assert.UTCDate(val, 2011, 01, 24, 4, 5, 00, 68);
79+
}
80+
}, {
7481
name: 'timestampz with huge miliseconds in UTC',
7582
dataTypeID: 1184,
7683
actual: '2010-10-30 14:11:12.730838Z',

0 commit comments

Comments
 (0)