Files
DefinitelyTyped/pouchdb-mapreduce/pouchdb-mapreduce-tests.ts
Jeff Barnes 9a32cea0ad Pouchdb core fixes and mapreduce additions (#13472)
* pouchdb-core fixes.

* pouchdb-core fixes.

* pouchdb-mapreduce additions.

* add semicolons.

* Mapreduce fixes from code review.

* Add third parameter to Pouchdb.adapter()

* Make Pouchdb.adapter() third parameter optional.

* Duplicate docs for overloaded functions.

* Remove PouchDB.adapter(...) definition.
2016-12-27 19:42:23 -05:00

37 lines
1.0 KiB
TypeScript

namespace PouchDBBrowserTests {
function testConstructor() {
type MyModel = { numericProperty: number };
let model: PouchDB.Core.Document<MyModel>;
let db = new PouchDB<MyModel>('mydb');
db.viewCleanup().catch((error) => {
});
}
function testQuery() {
let pouch = new PouchDB<{}>('mydb');
// find pokemon with name === 'Pika pi!'
pouch.query('my_index/by_name', {
key : 'Pika pi!',
include_docs : true
}).then(function (result) {
// handle result
}).catch(function (err) {
// handle errors
});
// find the first 5 pokemon whose name starts with 'P'
pouch.query('my_index/by_name', {
startkey : 'P',
endkey : 'P\uffff',
limit : 5,
include_docs : true
}).then(function (result) {
// handle result
}).catch(function (err) {
// handle errors
});
}
}