UNPKG

2.28 kBJavaScriptView Raw
1
2var Backend = require('../');
3
4module.exports.interface = {};
5
6module.exports.interface.get = function(test, common) {
7 test('get()', function(t) {
8 t.equal(typeof Backend.prototype.get, 'function', 'valid function');
9 t.equal(Backend.prototype.get.length, 3, 'consistent arguments length');
10 t.end();
11 });
12}
13
14module.exports.interface.mget = function(test, common) {
15 test('mget()', function(t) {
16 t.equal(typeof Backend.prototype.mget, 'function', 'valid function');
17 t.equal(Backend.prototype.mget.length, 3, 'consistent arguments length');
18 t.end();
19 });
20}
21
22module.exports.interface.put = function(test, common) {
23 test('put()', function(t) {
24 t.equal(typeof Backend.prototype.put, 'function', 'valid function');
25 t.equal(Backend.prototype.put.length, 4, 'consistent arguments length');
26 t.end();
27 });
28}
29
30module.exports.interface.search = function(test, common) {
31 test('search()', function(t) {
32 t.equal(typeof Backend.prototype.search, 'function', 'valid function');
33 t.equal(Backend.prototype.search.length, 3, 'consistent arguments length');
34 t.end();
35 });
36}
37
38module.exports.interface.createPullStream = function(test, common) {
39 test('createPullStream()', function(t) {
40 t.equal(typeof Backend.prototype.createPullStream, 'function', 'valid function');
41 t.equal(Backend.prototype.createPullStream.length, 0, 'consistent arguments length');
42 t.end();
43 });
44}
45
46module.exports.interface.findAdminHeirachy = function(test, common) {
47 test('findAdminHeirachy()', function(t) {
48 t.equal(typeof Backend.prototype.findAdminHeirachy, 'function', 'valid function');
49 t.equal(Backend.prototype.findAdminHeirachy.length, 3, 'consistent arguments length');
50 t.end();
51 });
52}
53
54module.exports.interface.reverseGeo = function(test, common) {
55 test('reverseGeo()', function(t) {
56 t.equal(typeof Backend.prototype.reverseGeo, 'function', 'valid function');
57 t.equal(Backend.prototype.reverseGeo.length, 3, 'consistent arguments length');
58 t.end();
59 });
60}
61
62module.exports.all = function (tape, common) {
63
64 function test(name, testFunction) {
65 return tape('external interface: ' + name, testFunction)
66 }
67
68 for( var testCase in module.exports.interface ){
69 module.exports.interface[testCase](test, common);
70 }
71}
\No newline at end of file