forked from pouchdb/pouchdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.http.js
43 lines (33 loc) · 1007 Bytes
/
test.http.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*globals initTestDB: false, emit: true, generateAdapterUrl: false */
/*globals PERSIST_DATABASES: false, initDBPair: false, utils: true */
/*globals ajax: true, LevelPouch: true */
"use strict";
var adapter = 'http-1';
var qunit = module;
if (typeof module !== undefined && module.exports) {
Pouch = require('../src/pouch.js');
LevelPouch = require('../src/adapters/pouch.leveldb.js');
utils = require('./test.utils.js');
for (var k in utils) {
global[k] = global[k] || utils[k];
}
qunit = QUnit.module;
}
qunit("http-adapter", {
setup: function() {
this.name = generateAdapterUrl(adapter);
},
teardown: function() {
if (!PERSIST_DATABASES) {
Pouch.destroy(this.name);
}
}
});
asyncTest("Create a pouch without DB setup", function() {
var instantDB;
instantDB = new Pouch(this.name, {skipSetup: true});
instantDB.post({test:"abc"}, function(err, info) {
ok(err && err.error === 'not_found', 'Skipped setup of database');
start();
});
});