remove require.paths use
This commit is contained in:
parent
24b664efbd
commit
d9fbe9e878
@ -65,6 +65,12 @@ var ctor = function(config) {
|
|||||||
connection._namedQueries = {};
|
connection._namedQueries = {};
|
||||||
connection._activeQuery = null;
|
connection._activeQuery = null;
|
||||||
connection._config = utils.normalizeConnectionInfo(config);
|
connection._config = utils.normalizeConnectionInfo(config);
|
||||||
|
//attach properties to normalize interface with pure js client
|
||||||
|
connection.user = connection._config.user;
|
||||||
|
connection.password = connection._config.password;
|
||||||
|
connection.database = connection._config.database;
|
||||||
|
connection.host = connection._config.host;
|
||||||
|
connection.port = connection._config.port;
|
||||||
connection.on('connect', function() {
|
connection.on('connect', function() {
|
||||||
connection._connected = true;
|
connection._connected = true;
|
||||||
connection._pulseQueryQueue(true);
|
connection._pulseQueryQueue(true);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
var helper = require(__dirname + '/test-helper');
|
var helper = require(__dirname + '/test-helper');
|
||||||
var pg = require("index");
|
var pg = helper.pg;
|
||||||
|
|
||||||
test('default values', function() {
|
test('default values', function() {
|
||||||
assert.same(pg.defaults,{
|
assert.same(pg.defaults,{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var net = require('net');
|
var net = require('net');
|
||||||
var helper = require(__dirname+'/../test-helper');
|
var helper = require(__dirname+'/../test-helper');
|
||||||
var Connection = require('connection');
|
var Connection = require(__dirname + '/../../../lib/connection');
|
||||||
var connect = function(callback) {
|
var connect = function(callback) {
|
||||||
var username = helper.args.user;
|
var username = helper.args.user;
|
||||||
var database = helper.args.database;
|
var database = helper.args.database;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
require.paths.unshift(__dirname + '/../lib/');
|
|
||||||
//make assert a global...
|
//make assert a global...
|
||||||
assert = require('assert');
|
assert = require('assert');
|
||||||
|
|
||||||
@ -6,7 +5,7 @@ var EventEmitter = require('events').EventEmitter;
|
|||||||
var sys = require('sys');
|
var sys = require('sys');
|
||||||
var BufferList = require(__dirname+'/buffer-list')
|
var BufferList = require(__dirname+'/buffer-list')
|
||||||
|
|
||||||
var Connection = require('connection');
|
var Connection = require(__dirname + '/../lib/connection');
|
||||||
var args = require(__dirname + '/cli');
|
var args = require(__dirname + '/cli');
|
||||||
|
|
||||||
Client = require(__dirname + '/../lib').Client;
|
Client = require(__dirname + '/../lib').Client;
|
||||||
@ -94,6 +93,9 @@ assert.empty = function(actual) {
|
|||||||
|
|
||||||
assert.success = function(callback) {
|
assert.success = function(callback) {
|
||||||
return assert.calls(function(err, arg) {
|
return assert.calls(function(err, arg) {
|
||||||
|
if(err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
assert.isNull(err);
|
assert.isNull(err);
|
||||||
callback(arg);
|
callback(arg);
|
||||||
})
|
})
|
||||||
@ -214,7 +216,7 @@ var Sink = function(expected, timeout, callback) {
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
args: args,
|
args: args,
|
||||||
Sink: Sink,
|
Sink: Sink,
|
||||||
pg: require('index'),
|
pg: require(__dirname + '/../lib/'),
|
||||||
connectionString: function() {
|
connectionString: function() {
|
||||||
return "pg"+(count++)+"://"+args.user+":"+args.password+"@"+args.host+":"+args.port+"/"+args.database;
|
return "pg"+(count++)+"://"+args.user+":"+args.password+"@"+args.host+":"+args.port+"/"+args.database;
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
var helper = require(__dirname + '/test-helper');
|
var helper = require(__dirname + '/test-helper');
|
||||||
var Connection = require('connection');
|
var Connection = require(__dirname + '/../../../lib/connection');
|
||||||
var con = new Connection({stream: "NO"});
|
var con = new Connection({stream: "NO"});
|
||||||
var client = new Client({connection:con});
|
var client = new Client({connection:con});
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
var helper = require(__dirname+'/../test-helper');
|
var helper = require(__dirname+'/../test-helper');
|
||||||
var Connection = require('connection');
|
var Connection = require(__dirname + '/../../../lib/connection');
|
||||||
var makeClient = function() {
|
var makeClient = function() {
|
||||||
var connection = new Connection({stream: "no"});
|
var connection = new Connection({stream: "no"});
|
||||||
connection.startup = function() {};
|
connection.startup = function() {};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
var helper = require(__dirname + '/test-helper');
|
var helper = require(__dirname + '/test-helper');
|
||||||
var Connection = require('connection');
|
var Connection = require(__dirname + '/../../../lib/connection');
|
||||||
var con = new Connection({stream: new MemoryStream()});
|
var con = new Connection({stream: new MemoryStream()});
|
||||||
test("connection emits stream errors", function() {
|
test("connection emits stream errors", function() {
|
||||||
assert.emits(con, 'error', function(err) {
|
assert.emits(con, 'error', function(err) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
require(__dirname+'/test-helper');
|
require(__dirname+'/test-helper');
|
||||||
var Connection = require('connection');
|
var Connection = require(__dirname + '/../../../lib/connection');
|
||||||
var buffers = require(__dirname + '/../../test-buffers');
|
var buffers = require(__dirname + '/../../test-buffers');
|
||||||
var PARSE = function(buffer) {
|
var PARSE = function(buffer) {
|
||||||
return new Parser(buffer).parse();
|
return new Parser(buffer).parse();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
require(__dirname + "/test-helper");
|
require(__dirname + "/test-helper");
|
||||||
var Connection = require('connection');
|
var Connection = require(__dirname + '/../../../lib/connection');
|
||||||
var stream = new MemoryStream();
|
var stream = new MemoryStream();
|
||||||
var con = new Connection({
|
var con = new Connection({
|
||||||
stream: stream
|
stream: stream
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
require(__dirname+'/test-helper');
|
require(__dirname+'/test-helper');
|
||||||
var Connection = require('connection');
|
var Connection = require(__dirname + '/../../../lib/connection');
|
||||||
test('connection can take existing stream', function() {
|
test('connection can take existing stream', function() {
|
||||||
var stream = new MemoryStream();
|
var stream = new MemoryStream();
|
||||||
var con = new Connection({stream: stream});
|
var con = new Connection({stream: stream});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var helper = require(__dirname+'/../test-helper');
|
var helper = require(__dirname+'/../test-helper');
|
||||||
var EventEmitter = require('events').EventEmitter;
|
var EventEmitter = require('events').EventEmitter;
|
||||||
var Connection = require('connection');
|
var Connection = require(__dirname + '/../../lib/connection');
|
||||||
MemoryStream = function() {
|
MemoryStream = function() {
|
||||||
EventEmitter.call(this);
|
EventEmitter.call(this);
|
||||||
this.packets = [];
|
this.packets = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user