2010-11-21 04:09:18 +08:00
|
|
|
require(__dirname + '/test-helper');
|
|
|
|
var pg = require("index");
|
|
|
|
|
|
|
|
test('default values', function() {
|
|
|
|
assert.same(pg.defaults,{
|
2011-03-02 04:28:44 +08:00
|
|
|
user: process.env.USER,
|
|
|
|
database: process.env.USER,
|
|
|
|
password: null,
|
2010-11-21 04:09:18 +08:00
|
|
|
port: 5432,
|
|
|
|
rows: 0,
|
|
|
|
poolSize: 10
|
|
|
|
})
|
|
|
|
test('are used in new clients', function() {
|
|
|
|
var client = new pg.Client();
|
|
|
|
assert.same(client,{
|
2011-03-02 04:28:44 +08:00
|
|
|
user: process.env.USER,
|
|
|
|
database: process.env.USER,
|
|
|
|
password: null,
|
2010-11-21 04:09:18 +08:00
|
|
|
port: 5432
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
test('modified values', function() {
|
2011-03-04 02:46:24 +08:00
|
|
|
return false;
|
2010-11-21 04:09:18 +08:00
|
|
|
pg.defaults.user = 'boom'
|
|
|
|
pg.defaults.password = 'zap'
|
|
|
|
pg.defaults.database = 'pow'
|
|
|
|
pg.defaults.port = 1234
|
|
|
|
pg.defaults.host = 'blam'
|
|
|
|
pg.defaults.rows = 10
|
|
|
|
pg.defaults.poolSize = 0
|
|
|
|
|
|
|
|
test('are passed into created clients', function() {
|
|
|
|
var client = new Client();
|
|
|
|
assert.same(client,{
|
|
|
|
user: 'boom',
|
|
|
|
password: 'zap',
|
|
|
|
database: 'pow',
|
|
|
|
port: 1234,
|
|
|
|
host: 'blam'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|