From 7ffd1f0ac5e06ac936ab286edc71e295d8b92f2e Mon Sep 17 00:00:00 2001 From: "Martin E. Zulliger" Date: Sat, 30 May 2015 12:36:23 +0200 Subject: [PATCH] Release 0.2.0 --- README.md | 5 ++++- package.json | 2 +- test/test-pgtest.js | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c7f02ba..0b9448d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ node-postgres-test is a module that provides easy unit testing for the popular [node-postgres](https://github.com/brianc/node-postgres). +## Install + npm install pgtest + ## Example ```javascript @@ -15,7 +18,7 @@ pgtest.expect('SELECT * FROM vegetables').returning(null, [ ]); pgtest.connect('foo', function (err, client, done) { - client.query('SELECT * FROM vegetables', function(err, data) { + client.query('SELECT * FROM vegetables', function (err, data) { console.log(data); done(); }); diff --git a/package.json b/package.json index d900d99..e8addf1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pgtest", - "version": "0.1.1", + "version": "0.2.0", "description": "A module that provides easy unit-testing for the popular node-postgres.", "main": "lib/pgtest.js", "scripts": { diff --git a/test/test-pgtest.js b/test/test-pgtest.js index 5560919..52f1e14 100644 --- a/test/test-pgtest.js +++ b/test/test-pgtest.js @@ -12,6 +12,24 @@ describe('pgtest', function () { pgtest.reset(true); }); + describe('Docs', function () { + it('should run the example in README', function () { + pgtest.expect('SELECT * FROM vegetables').returning(null, [ + [ 'potatoes', '1kg' ], + [ 'tomatoes', '500g' ] + ]); + + pgtest.connect('foo', function (err, client, done) { + client.query('SELECT * FROM vegetables', function (err, data) { + expect(data).to.be.deep.equal({ rows: [ [ 'potatoes', '1kg' ], [ 'tomatoes', '500g' ] ] }); + done(); + }); + }); + + pgtest.check(); //No errors + }); + }); + describe('connect', function () { it('should call its callback with a client and a done function', function (testDone) { pgtest.connect('foo', function (err, client, done) {