var specify = require('specify') , helpers = require('../helpers') , timeout = helpers.timeout , nano = helpers.nano , nock = helpers.nock ; var mock = nock(helpers.couch, "doc/insert") , db = nano.use("doc_insert") ; specify("doc_insert:setup", timeout, function (assert) { nano.db.create("doc_insert", function (err) { assert.equal(err, undefined, "Failed to create database"); }); }); specify("doc_insert:simple", timeout, function (assert) { db.insert({"foo": "baz"}, "foobaz", function (error, foo) { assert.equal(error, undefined, "Should have stored foo"); assert.equal(foo.ok, true, "Response should be ok"); assert.ok(foo.rev, "Response should have rev"); }); }); specify("doc_insert:params", timeout, function (assert) { db.insert({"foo": "baz"}, "foobaz", { new_edits: false }, function (error, foo) { assert.equal(error, undefined, "Should have stored foo"); assert.equal(foo.ok, true, "Response should be ok"); assert.ok(foo.rev, "Response should have rev"); });
, timeout = helpers.timeout , nano = helpers.nano , nock = helpers.nock ; var mock = nock(helpers.couch, "doc/head") , db = nano.use("doc_head") , rev ; specify("doc_head:setup", timeout, function (assert) { nano.db.create("doc_head", function (err) { assert.equal(err, undefined, "Failed to create database"); db.insert({"foo":"baz"}, "foobaz", function (error, foo) { assert.equal(error, undefined, "Should have stored foobaz"); assert.equal(foo.ok, true, "Response should be ok"); assert.equal(foo.id, "foobaz", "My id is foobaz"); assert.ok(foo.rev, "Response should have rev"); rev = foo.rev; }); }); }); specify("doc_head:test", timeout, function (assert) { db.head("foobaz", function (error, body, headers) { assert.equal(error, undefined, "Should get the head of foobaz"); assert.equal(headers["status-code"], 200, "Should be ok"); }); }); specify("doc_head:teardown", timeout, function (assert) { nano.db.destroy("doc_head", function (err) {
, timeout = helpers.timeout , nano = helpers.nano , nock = helpers.nock ; var mock = nock(helpers.couch, "doc/get") , db = nano.use("doc_get") , rev ; specify("doc_get:setup", timeout, function (assert) { nano.db.create("doc_get", function (err) { assert.equal(err, undefined, "Failed to create database"); db.insert({"foo": "baz"}, "foobaz", function (error, foo) { assert.equal(error, undefined, "Should have stored foobaz"); assert.equal(foo.ok, true, "Response should be ok"); assert.equal(foo.id, "foobaz", "My id is foobaz"); assert.ok(foo.rev, "Response should have rev"); rev = foo.rev; }); }); }); specify("doc_get:test", timeout, function (assert) { db.insert({"foo": "bar"}, "foobaz", function (error, response) { assert.equal(error["status-code"], 409, "Should be conflict"); assert.equal(error.scope, "couch", "Scope is couch"); assert.equal(error.error, "conflict", "Error is conflict"); db.get("foobaz", {revs_info: true}, function (error, foobaz) { assert.equal(error, undefined, "Should get foobaz"); assert.ok(foobaz._revs_info, "Got revs info"); assert.equal(foobaz._id, "foobaz", "Id is food");
var specify = require('specify') , helpers = require('../helpers') , timeout = helpers.timeout , nano = helpers.nano , nock = helpers.nock ; var mock = nock(helpers.couch, "shared/headers") , db = nano.use("shared_headers") ; specify("shared_headers:setup", timeout, function (assert) { nano.db.create("shared_headers", function (err) { assert.equal(err, undefined, "Failed to create database"); }); }); specify("shared_headers:test", timeout, function (assert) { db.attachment.insert("new", "att", "Hello", "text/plain", function (error, hello) { assert.equal(error, undefined, "Should store hello"); assert.equal(hello.ok, true, "Response should be ok"); assert.ok(hello.rev, "Should have a revision number"); nano.request({ db:"shared_headers", doc:"new", att:"att", headers:{ "If-None-Match":JSON.stringify(hello.rev) } }, function (error, helloWorld, rh) {
var specify = require('specify') , helpers = require('../helpers') , timeout = helpers.timeout , nano = helpers.nano , nock = helpers.nock ; var mock = nock(helpers.couch, "db/encodeDbName"); var db_name = "az09_$()+-/"; specify("db_create:test", timeout, function (assert) { nano.db.create(db_name, function (err) { assert.equal(err, undefined, "Failed to create database"); }); }); specify("db_create:teardown", timeout, function (assert) { nano.db.destroy(db_name, function (err) { assert.equal(err, undefined, "Failed to destroy database"); assert.ok(mock.isDone(), "Some mocks didn't run"); }); }); specify.run(process.argv.slice(2));
; var mock = nock(helpers.cloudant_auth, "cloudant/auth"); var third_party = null; specify('cloudant:generate_api_key', timeout, function (assert) { var client = Cloudant({account:'nodejs'}) // No password var pw_error = null try { client.generate_api_key(function() {}) } catch (er) { pw_error = er } assert.ok(pw_error, 'Throw an error if a password is not provided'); client = Cloudant({account:'nodejs', password:helpers.cloudant_pw()}) client.generate_api_key(function(er, body) { assert.equal(er, undefined, 'Hit the generate_api_key endpoint'); assert.equal(body.ok, true, 'Good response generating API key'); assert.ok(body.key , 'Good API key'); assert.ok(body.password , 'Good API password'); // Store this for later, to grant permissions to this third party. third_party = body.key; }); }); specify('cloudant:set_permissions', timeout, function (assert) { var client = Cloudant({account:'nodejs'}) // No password var pw_error = null try { client.set_permissions({}, function() {}) }
var mock = nock(helpers.couch, "db/replicate") , db = nano.use("db_replicate") , replica = nano.use("db_replica") , replica2 = nano.use("db_replica2") ; specify("db_replicate:setup", timeout, function (assert) { async.series( [ function(cb) { nano.db.create("db_replicate", cb); } , function(cb) { nano.db.create("db_replica", cb); } , function(cb) { nano.db.create("db_replica2", cb); } ] , function(error, results) { assert.equal(error, undefined, "Should have created databases"); async.parallel( [ function(cb) { db.insert({"foo": "bar"}, "foobar", cb); } , function(cb) { db.insert({"bar": "foo"}, "barfoo", cb); } , function(cb) { db.insert({"foo": "baz"}, "foobaz", cb); } ] , function(error, results){ assert.equal(error, undefined, "Should have stored docs"); }); }); }); specify("db_replicate:test", timeout, function (assert) { db.replicate("db_replica", function(error) { assert.equal(error, undefined, "Should be able to replicate"); replica.list(function (error, list) { assert.equal(error, undefined, "Should be able to list"); assert.equal(list.total_rows, 3, "Should have three documents");
var specify = require('specify') , helpers = require('../helpers') , run = helpers.run , futon_ok = helpers.futon_ok , futon_not_ok = helpers.futon_not_ok , get_config = helpers.get_config ; helpers.setup(); specify('futon endpoint', function (assert) { assert.expect(3); run('futon endpoint') .expect(function (response) { futon_ok(assert, response); }) .end(function () { assert.ok(true); }); }); specify('futon endpoint list', function (assert) { assert.expect(3); run('futon endpoint list') .expect(function (response) { futon_ok(assert, response); }) .end(function () { assert.ok(true);
var _Error = require('../_error'), assert = require('assert'), specify = require('specify'); specify('message', function (assert) { var e = new _Error('the message'); assert.ok(e, 'Object created.'); assert.strictEqual(e.message, 'the message', 'Message is correct'); }); specify('object', function (assert) { var e = new _Error('the message', {a:1, b:2, c:{d:4}}); assert.ok(e.a && e.b && e.c, 'Keys exist.'); assert.equal(e.a, 1, 'Key values are correct.'); assert.equal(e.b, 2, 'Key values are correct.'); assert.equal(e.c.d, 4, 'Key values are correct.'); }); specify.run(process.argv.slice(2));
client.on("metrics", function (type, key, val) { console.log("\tmetric: " + type + ", " + key + "=" + val); }); client.on("error", function (err) { console.error(new Error(err.message).stack); process.exit(0); }); specify("put", function (assert) { var bucket = "bucket_1", key = "key_0", message = "some string full of juicy data", options = {}; client.put(bucket, key, message, options, function (err, res, obj) { assert.ok(!err); assert.equal(res.statusCode, 204); }); }); specify("returnbody", function (assert) { var bucket = "bucket_1", key = "key_1", message = "some string full of juicy data", options = { return_body: true }; client.put(bucket, key, message, options, function (err, res, obj) { assert.ok(!err); assert.equal(res.statusCode, 200); });
var specify = require('specify') , helpers = require('../helpers') , timeout = helpers.timeout , nano = helpers.nano , nock = helpers.nock ; var mock = nock(helpers.couch, "att/get") , db = nano.use("att_get") ; specify("att_get:setup", timeout, function (assert) { nano.db.create("att_get", function (err) { assert.equal(err, undefined, "Failed to create database"); }); }); specify("att_get:test", timeout, function (assert) { db.attachment.insert("new", "att", "Hello", "text/plain", function(error, hello) { assert.equal(error, undefined, "Should store hello"); assert.equal(hello.ok, true, "Response should be ok"); assert.ok(hello.rev, "Should have a revision number"); db.attachment.get("new", "att", function (error, helloWorld) { assert.equal(error, undefined, "Should get the hello"); assert.equal("Hello", helloWorld, "hello is reflexive"); }); }); });
specify('Text categorization - feature extractor', function(test) { var opts = { feature_extractor: function(input, features) { // a simple 1-gram word extractor: var words = input.split(" "); for (var i=0; i<words.length; ++i) features[words[i]]=1; }, learningrate: 1, debug: 0 }; var news = perceptron(opts) news.train("This is a very new information", 1) news.train("This is a very old information", 0) news.train("I bring you the new relevant fantastic story", 1) news.train("Did you hear the old story ?", 0) var count = 0 while(!news.retrain() && count<20) { count++ } //console.dir(news.weights); // binary test: test.equal(news.perceive("There is some new information in the pub"), 1); test.equal(news.perceive("This story is too old to be interesting"), 0); // net test: test.ok(news.perceive("There is some new information in the pub", true) > 0); test.ok(news.perceive("This story is too old to be interesting", true) < 0); })
var specify = require('specify') , helpers = require('../helpers') , timeout = helpers.timeout , nock = helpers.nock ; var mock = nock(helpers.cloudant_url, "cloudant/connect"); var Cloudant = require('../..'); specify('cloudant:connect:by_object', timeout, function (assert) { var client = Cloudant({account:'nodejs'}) client.request('', function (er, body, headers) { assert.equal(er, undefined, 'Ping Cloudant'); assert.equal(headers['status-code'], 200, 'Cloudant ping status OK'); assert.equal(body.couchdb, 'Welcome', 'Welcome message from Cloudant ping'); assert.ok(body.version, 'Cloudant version string'); }); }); specify('cloudant:connect:with_url', timeout, function (assert) { var client = Cloudant({account:'http//nodejs.cloudant.com/'}) client.request('', function (er, body, headers) { assert.equal(er, undefined, 'Ping Cloudant'); assert.equal(headers['status-code'], 200, 'Cloudant ping status OK'); assert.equal(body.couchdb, 'Welcome', 'Welcome message from Cloudant ping'); assert.ok(body.version, 'Cloudant version string'); }); }); specify('cloudant:connect:authenticated', timeout, function (assert) { var client = Cloudant({account:'nodejs', password:helpers.cloudant_pw()})
, timeout = helpers.timeout , nano = helpers.nano , Nano = helpers.Nano , nock = helpers.nock ; var mock = nock(helpers.couch, "shared/error") , db = nano.use("shared_error") ; specify("shared_error:setup", timeout, function (assert) { nano.db.create("shared_error", function (err) { assert.equal(err, undefined, "Failed to create database"); db.insert({"foo": "baz"}, "foobaz", function (error, foo) { assert.equal(error, undefined, "Should have stored foobaz"); assert.equal(foo.ok, true, "Response should be ok"); assert.equal(foo.id, "foobaz", "My id is foobaz"); assert.ok(foo.rev, "Response should have rev"); }); }); }); specify("shared_error:conflict", timeout, function (assert) { db.insert({"foo": "bar"}, "foobaz", function (error, response) { assert.equal(error["status-code"], 409, "Should be conflict"); assert.equal(error.message, error.reason, "Message should be reason"); assert.equal(error.scope, "couch", "Scope is couch"); assert.equal(error.error, "conflict", "Error is conflict"); }); });
var badword = require("./index"), specify = require("specify"); specify("sanity test", function(assert) { assert.equal(badword("asshole"), true, "asshole isn't a bad word"); assert.equal(badword("ross"), false, "ross is a bad word"); }); specify.run();
var specify = require('specify') , helpers = require('../helpers') , timeout = helpers.timeout , nano = helpers.nano , nock = helpers.nock ; var mock = nock(helpers.couch, "db/list"); specify("db_list:setup", timeout, function (assert) { nano.db.create("db_list", function (err) { assert.equal(err, undefined, "Failed to create database"); }); }); specify("db_list:test", timeout, function (assert) { nano.db.list(function (error, list) { assert.equal(error, undefined, "Failed to list databases"); var filtered = list.filter(function (e) { return e === "db_list" || e === "_replicator" || e === "_users"; }); assert.equal(filtered.length, 3, "Has exactly those threee dbs"); }); }); specify("db_list:teardown", timeout, function (assert) { nano.db.destroy("db_list", function (err) { assert.equal(err, undefined, "Failed to destroy database"); assert.ok(mock.isDone(), "Some mocks didn't run"); }); });
// returns a mock message function message (s) { return { match_data: null , user: '******' , source: s , say: noop , text: [ s ] } }; specify('search', function (a) { a.expect(searches.length) searches.forEach(function (s) { var m = message(s) var reply = router(m, noop) console.log(m.source, '->', reply) a.ok(reply) }); }) specify('docs', function (a) { a.expect(docs.length) docs.forEach(function (s) { var m = message(s) router(m, function(err, reply) { if (err) a.ok(err) else a.ok(reply.indexOf('http')) reply = err || reply console.log(m.source, '->', reply)
var specify = require('specify') , helpers = require('../helpers') , timeout = helpers.timeout , nano = helpers.nano , Nano = helpers.Nano , nock = helpers.nock , couch = helpers.couch ; var mock = nock(helpers.couch, "shared/config"); specify("shared_config:root", timeout, function (assert) { nano.dinosaur('', function (err, response) { assert.equal(err, undefined, "Failed to get root"); assert.ok(response.version, "Version is defined"); }); nano.relax(function (err, response) { assert.equal(err, undefined, "Failed to get root"); assert.ok(response.version, "Version is defined"); }); }); specify("shared_config:ping", timeout, function (assert) { nano.ping(function (err, pong) { assert.equal(err, undefined, "Failed to ping"); assert.ok(pong.version, "Pong version is defined"); assert.ok(pong.userCtx, "Pong userCtx is defined"); }); Nano(helpers.couch, function (err, pong) { assert.equal(err, undefined, "Failed to automatically run ping callback"); assert.ok(pong.version, "Pong version is defined");
var specify = require('specify'); var request = require('request'); specify('getSurveys', function(assert){ var get = { uri: 'http://*****:*****@omatom.com'); assert.equal(body.sample_size, 8317); assert.equal(body.channel, 'Capi'); assert.equal(body.organisation, 'ad-hoc') assert.equal(body.registration_type, 'observation'); assert.equal(body.method, 'quantitative'); }); }); specify('getSurveysResultsById', function(assert){
var mock = nock(helpers.couch, "db/follow") , db = nano.use("db_follow") , feed ; specify("db_follow:setup", timeout, function (assert) { nano.db.create("db_follow", function (err) { assert.equal(err, undefined, "Failed to create database"); async.parallel( [ function (cb) { db.insert({"foo":"bar"}, "foobar", cb); } , function (cb) { db.insert({"bar":"foo"}, "barfoo", cb); } , function (cb) { db.insert({"foo":"baz"}, "foobaz", cb); } ] , function (error, results) { assert.equal(error, undefined, "Should have stored docs"); }); }); }); if (!process.env.NOCK) { // nock doesn support streaming // please run tests with local couchdb specify("db_follow:stream", timeout, function (assert) { assert.expect(2);
var mock = nock(helpers.couch, "view/multiple") , db = nano.use("view_multiple") ; specify("view_multiple:setup", timeout, function (assert) { nano.db.create("view_multiple", function (err) { assert.equal(err, undefined, "Failed to create database"); db.insert( { "views": { "by_id": { "map": function(doc) { emit(doc._id, doc); } } } }, '_design/alice', function (error, response) { assert.equal(error, undefined, "Failed to create views"); assert.equal(response.ok, true, "Response should be ok"); async.parallel( [ function(cb) { db.insert({"foo": "bar"}, "foobar", cb); } , function(cb) { db.insert({"bar": "foo"}, "barfoo", cb); } , function(cb) { db.insert({"foo": "baz"}, "foobaz", cb); } ] , function(error, results) { assert.equal(error, undefined, "Should have stored docs"); }); }); }); }); specify("view_multiple:test", timeout, function (assert) { db.view('alice','by_id', { keys: ['foobar', 'barfoo'], include_docs: true }, function (err, view) { assert.equal(err, undefined, "View didn't respond");
, db = nano.use("view_query") ; specify("view_query:setup", timeout, function (assert) { nano.db.create("view_query", function (err) { assert.equal(err, undefined, "Failed to create database"); db.insert( { "views": { "by_name_and_city": { "map": function(doc) { emit([doc.name, doc.city], doc._id); } } } }, '_design/people', function (error, response) { assert.equal(error, undefined, "Failed to create views"); assert.equal(response.ok, true, "Response should be ok"); async.parallel( [ function(cb) { db.insert( { name: "Derek", city: "San Francisco" }, "p_derek", cb); } , function(cb) { db.insert( { name: "Randall", city: "San Francisco" }, "p_randall", cb); } , function(cb) { db.insert( { name: "Nuno", city: "New York" }, "p_nuno", cb); } ] , function(error, results) { assert.equal(error, undefined, "Should have stored docs"); }); }); }); }); specify("view_query:test", timeout, function (assert) { db.view('people','by_name_and_city',
, timeout = helpers.timeout , nano = helpers.nano , nock = helpers.nock ; var mock = nock(helpers.couch, "doc/update") , db = nano.use("doc_update") , rev ; specify("doc_update:setup", timeout, function (assert) { nano.db.create("doc_update", function (err) { assert.equal(err, undefined, "Failed to create database"); db.insert({"foo": "baz"}, "foobar", function (error, foo) { assert.equal(error, undefined, "Should have stored foo"); assert.equal(foo.ok, true, "Response should be ok"); assert.ok(foo.rev, "Response should have rev"); rev = foo.rev; }); }); }); specify("doc_update:test", timeout, function (assert) { db.insert({foo: "bar", "_rev": rev}, "foobar", function (error, response) { assert.equal(error, undefined, "Should have deleted foo"); assert.equal(response.ok, true, "Response should be ok"); }); }); specify("doc_update:teardown", timeout, function (assert) { nano.db.destroy("doc_update", function (err) {
, path = require('path') , specify = require('specify') , helpers = require('../helpers') , timeout = helpers.timeout , nano = helpers.nano , nock = helpers.nock , pixel = helpers.pixel ; var mock = nock(helpers.couch, "att/pipe") , db = nano.use("att_pipe") ; specify("att_pipe:setup", timeout, function (assert) { nano.db.create("att_pipe", function (err) { assert.equal(err, undefined, "Failed to create database"); }); }); specify("att_pipe:write", timeout, function (assert) { var buffer = new Buffer(pixel, 'base64') , filename = path.join(__dirname, '.temp.bmp') , ws = fs.createWriteStream(filename) ; ws.on('close', function () { assert.equal(fs.readFileSync(filename).toString('base64'), pixel); fs.unlinkSync(filename); }); db.attachment.insert("new", "att", buffer, "image/bmp", function (error, bmp) { assert.equal(error, undefined, "Should store the pixel");
var auth_mock = nock(helpers.cloudant_auth, "cloudant/auth"); var serv_mock = nock(helpers.cloudant_url , "cloudant/auth_me"); var third_party = {key:null, password:null}; specify('cloudant:generate_api_key', timeout, function (assert) { var client = Cloudant({account:'nodejs'}) // No password var pw_error = null try { client.generate_api_key(function() {}) } catch (er) { pw_error = er } assert.ok(pw_error, 'Throw an error if a password is not provided'); client = Cloudant({account:'nodejs', password:helpers.cloudant_pw()}) client.generate_api_key(function(er, body) { assert.equal(er, undefined, 'Hit the generate_api_key endpoint'); assert.equal(body.ok, true, 'Good response generating API key'); assert.ok(body.key , 'Good API key'); assert.ok(body.password , 'Good API password'); // Store this for later, to grant permissions to this third party. third_party.key = body.key; third_party.password = body.password; }); }); specify('cloudant:third_party_access', timeout, function (assert) { Cloudant({account:'nodejs', key:third_party.key, password:third_party.password}, function(er, cloudant, body) { assert.equal(er, undefined, 'Connect and authenticate using the new API key'); assert.ok(body && body.userCtx, 'Third-party connect got a good pong'); assert.equal(body.userCtx.name, third_party.key, 'Third-party correctly identified by Cloudant server');
var Client = require("../lib/client"), invalidClient = new Client({ key: "invalid" }), validClient = new Client({ key: validKey }); var nock = require("nock"), specify = require("specify"); specify("gasstations json success", function(assert) { var scope = nock("https://www.car2go.com") .get("/api/v2.1/gasstations?format=json&loc=ulm&oauth_consumer_key=" + validKey) .replyWithFile(200, __dirname + "/replies/gasstations-200-0.json", { "content-type": "application/json; charset=utf-8" }); validClient.gasstations({ format: "json", loc: "ulm" }, function(err, areas) { assert.equal(err, null); assert.ok(Array.isArray(areas)); assert.ok(areas.length > 0); }); }); specify("gasstations kml success", function(assert) { var scope = nock("https://www.car2go.com") .get("/api/v2.1/gasstations?format=kml&loc=ulm&oauth_consumer_key=" + validKey) .replyWithFile(200, __dirname + "/replies/gasstations-200-0.json", { "content-type": "application/vnd.google-earth.kml+xml; charset=utf-8" });
var specify = require('specify') , helpers = require('../helpers') , timeout = helpers.timeout , nano = helpers.nano , Nano = helpers.Nano , nock = helpers.nock , couch = helpers.couch ; var mock = nock(helpers.couch, "shared/config"); specify("shared_config:root", timeout, function (assert) { nano.dinosaur('', function (err, response) { assert.equal(err, undefined, "Failed to get root"); assert.ok(response.version, "Version is defined"); }); nano.relax(function (err, response) { assert.equal(err, undefined, "Failed to get root"); assert.ok(response.version, "Version is defined"); }); }); specify("shared_config:url_parsing", timeout, function (assert) { var base_url = 'http://someurl.com'; assert.equal(Nano(base_url).config.url, base_url, "Simple URL failed"); assert.equal( Nano(base_url+'/').config.url, base_url+'/', "Simple URL with / failed"); assert.equal( Nano('http://*****:*****@someurl.com:5984').config.url, 'http://*****:*****@someurl.com:5984', "Auth failed"); assert.equal(
var specify = require('specify') , helpers = require('../helpers') , timeout = helpers.timeout , nano = helpers.nano , nock = helpers.nock ; var mock = nock(helpers.couch, "multipart/insert") , db = nano.use("multipart_insert") ; specify("multipart_insert:setup", timeout, function (assert) { nano.db.create("multipart_insert", function (err) { assert.equal(err, undefined, "Failed to create database"); }); }); specify("multipart_insert:test", timeout, function (assert) { var att = { name: 'att', data: 'Hello World!', content_type: 'text/plain' }; db.multipart.insert({"foo": "baz"}, [att], "foobaz", function (error, foo) { assert.equal(error, undefined, "Should have stored foo and attachment"); assert.equal(foo.ok, true, "Response should be ok"); assert.ok(foo.rev, "Response should have rev"); }); }); specify("multipart_insert:test_with_attachment_containing_unicode_characters", timeout, function (assert) {
var server = require('../'), specify = require('specify'); request = require('request'); server(4000, 'test'); specify('test root no slash', function(assert) { request('http://localhost:4000', function(e,r,b) { assert.ok(/Hello World/.test(b)); }); }); specify('test specific page', function(assert) { request.get('http://localhost:4000/fixture.html', function(e,r,b) { assert.equal('<h1>Hello World</h1>\n', b); }); }); specify.run();
var specify = require('specify') , helpers = require('../helpers') , timeout = helpers.timeout , nano = helpers.nano , nock = helpers.nock ; var mock = nock(helpers.couch, "db/get"); specify("db_get:setup", timeout, function (assert) { nano.db.create("db_get", function (err) { assert.equal(err, undefined, "Failed to create database"); }); }); specify("db_get:test", timeout, function (assert) { nano.db.get("db_get", function (error, response) { assert.equal(error, undefined, "Failed to get database"); assert.equal(response.doc_count, 0, "I can haz docs?"); assert.equal(response.db_name, "db_get"); }); }); specify("db_get:teardown", timeout, function (assert) { nano.db.destroy("db_get", function (err) { assert.equal(err, undefined, "Failed to destroy database"); assert.ok(mock.isDone(), "Some mocks didn't run"); }); }); specify.run(process.argv.slice(2));