Skip to content

Commit 312a3dd

Browse files
committed
update tests to assert local time for timestamp without timezone -- bumps minor version
1 parent ecee552 commit 312a3dd

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{ "name": "pg",
2-
"version": "0.9.0",
2+
"version": "0.10.0",
33
"description": "PostgreSQL client - pure javascript & libpq with the same API",
44
"keywords" : ["postgres", "pg", "libpq", "postgre", "database", "rdbms"],
55
"homepage": "http://github.com/brianc/node-postgres",

test/unit/client/query-tests.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ q.dateParser = require(__dirname + "/../../../lib/types").getTypeParser(1114, 't
44
q.stringArrayParser = require(__dirname + "/../../../lib/types").getTypeParser(1009, 'text');
55

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

1010
var testForMs = function(part, expected) {
@@ -19,19 +19,19 @@ testForMs('.1', 100);
1919
testForMs('.01', 10);
2020
testForMs('.74', 740);
2121

22-
test("testing 2dateParser", function() {
22+
test("testing 2dateParser on dates without timezones", function() {
2323
var actual = "2010-12-11 09:09:04.1";
24-
var expected = "\"2010-12-11T09:09:04.100Z\"";
24+
var expected = JSON.stringify(new Date(2010,11,11,9,9,4,100))
2525
assert.equal(JSON.stringify(q.dateParser(actual)),expected);
2626
});
2727

28-
test("testing 2dateParser", function() {
28+
test("testing 2dateParser on dates with timezones", function() {
2929
var actual = "2011-01-23 22:15:51.28-06";
3030
var expected = "\"2011-01-24T04:15:51.280Z\"";
3131
assert.equal(JSON.stringify(q.dateParser(actual)),expected);
3232
});
3333

34-
test("testing 2dateParser", function() {
34+
test("testing 2dateParser on dates with huge millisecond value", function() {
3535
var actual = "2011-01-23 22:15:51.280843-06";
3636
var expected = "\"2011-01-24T04:15:51.280Z\"";
3737
assert.equal(JSON.stringify(q.dateParser(actual)),expected);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ test('typed results', function() {
112112
dataTypeID: 1114,
113113
actual: '2010-10-31 00:00:00',
114114
expected: function(val) {
115-
assert.UTCDate(val, 2010, 9, 31, 0, 0, 0, 0);
115+
assert.equal(val.toUTCString(), new Date(2010, 9, 31, 0, 0, 0, 0, 0).toUTCString());
116+
assert.equal(val.toString(), new Date(2010, 9, 31, 0, 0, 0, 0, 0, 0).toString());
116117
}
117118
},{
118119
name: 'date',

0 commit comments

Comments
 (0)