update tests to assert local time for timestamp without timezone -- bumps minor version

This commit is contained in:
brianc 2012-12-10 21:24:40 -06:00
parent ecee5529e4
commit 312a3dd01c
3 changed files with 8 additions and 7 deletions

View File

@ -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",

View File

@ -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);

View File

@ -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',