node-postgres/test/unit/test-helper.js
Brian C 8798e50ad3 Re-enable eslint with standard format (#1367)
* Work on converting lib to standard

* Finish updating lib

* Finish linting lib

* Format test files

* Add .eslintrc with standard format

* Supply full path to eslint bin

* Move lint command to package.json

* Add eslint as dev dependency
2017-07-15 12:05:58 -05:00

37 lines
727 B
JavaScript

'use strict'
var EventEmitter = require('events').EventEmitter
var helper = require('../test-helper')
var Connection = require('../../lib/connection')
global.MemoryStream = function () {
EventEmitter.call(this)
this.packets = []
}
helper.sys.inherits(MemoryStream, EventEmitter)
var p = MemoryStream.prototype
p.write = function (packet) {
this.packets.push(packet)
}
p.setKeepAlive = function () {}
p.writable = true
const createClient = function () {
var stream = new MemoryStream()
stream.readyState = 'open'
var client = new Client({
connection: new Connection({stream: stream})
})
client.connect()
return client
}
module.exports = Object.assign({}, helper, {
createClient: createClient
})