Permalink
Browse files

update tests to assert local time for timestamp without timezone -- b…

…umps minor version
  • Loading branch information...
1 parent ecee552 commit 312a3dd01cac8fe2bf19af33199df7d986a9a4ee @brianc committed Dec 11, 2012
Showing with 8 additions and 7 deletions.
  1. +1 −1 package.json
  2. +5 −5 test/unit/client/query-tests.js
  3. +2 −1 test/unit/client/typed-query-results-tests.js
View
@@ -1,5 +1,5 @@
{ "name": "pg",
- "version": "0.9.0",
+ "version": "0.10.0",
"description": "PostgreSQL client - pure javascript & libpq with the same API",
"keywords" : ["postgres", "pg", "libpq", "postgre", "database", "rdbms"],
"homepage": "http://github.com/brianc/node-postgres",
@@ -4,7 +4,7 @@ q.dateParser = require(__dirname + "/../../../lib/types").getTypeParser(1114, 't
q.stringArrayParser = require(__dirname + "/../../../lib/types").getTypeParser(1009, 'text');
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").toString(),new Date("2010-12-11 09:09:04").toString());
});
var testForMs = function(part, expected) {
@@ -19,19 +19,19 @@ testForMs('.1', 100);
testForMs('.01', 10);
testForMs('.74', 740);
-test("testing 2dateParser", function() {
+test("testing 2dateParser on dates without timezones", function() {
var actual = "2010-12-11 09:09:04.1";
- var expected = "\"2010-12-11T09:09:04.100Z\"";
+ var expected = JSON.stringify(new Date(2010,11,11,9,9,4,100))
assert.equal(JSON.stringify(q.dateParser(actual)),expected);
});
-test("testing 2dateParser", function() {
+test("testing 2dateParser on dates with timezones", 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);
});
-test("testing 2dateParser", function() {
+test("testing 2dateParser on dates with huge millisecond value", function() {
var actual = "2011-01-23 22:15:51.280843-06";
var expected = "\"2011-01-24T04:15:51.280Z\"";
assert.equal(JSON.stringify(q.dateParser(actual)),expected);
@@ -112,7 +112,8 @@ test('typed results', function() {
dataTypeID: 1114,
actual: '2010-10-31 00:00:00',
expected: function(val) {
- assert.UTCDate(val, 2010, 9, 31, 0, 0, 0, 0);
+ assert.equal(val.toUTCString(), new Date(2010, 9, 31, 0, 0, 0, 0, 0).toUTCString());
+ assert.equal(val.toString(), new Date(2010, 9, 31, 0, 0, 0, 0, 0, 0).toString());
}
},{
name: 'date',

0 comments on commit 312a3dd

Please sign in to comment.