Files: 8f4b43a09aab9801bf28987edd59c2e366180327 / test / test-79-npm / pouchdb / pouchdb.js
583 bytesRaw
1 | ; |
2 | |
3 | var PouchDB = require('pouchdb'); |
4 | var db = new PouchDB('dbname'); |
5 | var rimraf = require('../../../node_modules/rimraf'); |
6 | |
7 | (function (cb) { |
8 | db.put({ |
9 | _id: 'dave@gmail.com', |
10 | name: 'David', |
11 | age: 68 |
12 | }, function (error1) { |
13 | if (error1) return cb(error1); |
14 | db.get('dave@gmail.com', function (error2, data) { |
15 | if (error2) return cb(error2); |
16 | if (data.age === 68) { |
17 | console.log('ok'); |
18 | return cb(); |
19 | } |
20 | }); |
21 | }); |
22 | }(function (error) { |
23 | if (error) throw error; |
24 | db.close(function () { |
25 | rimraf.sync('dbname'); |
26 | }); |
27 | })); |
28 |
Built with git-ssb-web