Skip to content

Commit

Permalink
use any-db-fake for unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
grncdr committed Dec 22, 2013
1 parent 48222a1 commit db25734
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
language: node_js
node_js: [ 0.8, '0.10' ]
script: make travis
before_script:
- psql -c 'create database any_db_test' -Upostgres
- mysql -e 'create database any_db_test' -uroot
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "Database-agnostic connection pooling, querying, and result sets",
"main": "index.js",
"scripts": {
"prepublish": "cp ../*.md .",
"test": "tap test/*.test.js"
"test": "node test.js"
},
"repository": {
"type": "git",
Expand All @@ -21,13 +20,11 @@
],
"license": "MIT",
"dependencies": {
"any-db-pool": ">= 0.0.6",
"any-db-pool": "~1.0.1",
"parse-db-url": "0.0.0"
},
"devDependencies": {
"any-db-sqlite3": "*",
"any-db-postgres": "*",
"any-db-mysql": "*",
"tape": "~2.3.2"
"tape": "~2.3.2",
"any-db-fake": "0.0.1"
}
}
26 changes: 26 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var test = require('tape')

test('API test', function (t) {
t.plan(4)
var anyDB = require('./')

t.pass('require("any-db") works')

t.test('exports.createConnection', function (t) {
t.plan(1)
anyDB.createConnection('fake://hostname/dbname', function (err, conn) {
if (err) throw err
t.pass('Created connection')
})
})

t.test('exports.createPool', function (t) {
t.plan(1)
anyDB.createPool('fake://hostname/dbname')
t.pass('Created pool')
})

t.throws(function () {
anyDB.adapters.fake
}, 'accessing exports.adapters throws')
})

0 comments on commit db25734

Please sign in to comment.