-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_db.js
46 lines (33 loc) · 927 Bytes
/
test_db.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
42
43
44
var q = require('kew'),
jf = require('jsonfile');
exports.config = {};
exports.init = function(overrides){
return q.resolve(true);
};
var answers = {};
exports.load_answers = function(filename){
answers = jf.readFileSync(filename);
};
exports.close = function(){};
function query(type){
var list = answers[type];
if (list && list.length){
return q.resolve(list.shift());
}
return q.reject('test_db.js:query - No data');
}
exports.fetch_timesheets = function(){
return query('fetch_timesheets');
};
exports.fetch_children = function(request_id, sort_by){
return query('fetch_children');
};
exports.load_child = function(request_id){
return query('load_child');
};
exports.load_child_quotes = function(request_id){
return query('load_child_quotes');
};
exports.load_child_timesheets = function(request_id){
return query('load_child_timesheets');
};