-
Notifications
You must be signed in to change notification settings - Fork 8
/
tester.js
89 lines (83 loc) · 2.42 KB
/
tester.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*global test_search_simple: false, test_search_advanced: false, test_format: false, test_websrv: false */
"use strict";
var config = require('./config');
var p = require('./debug')().p;
var host = 'http://localhost:' + config.port + '/';
module.exports = function (app) {
var tests = {
'search': [test_search_simple, test_search_advanced],
'format': [test_format],
'import': [],
'gnub' : [],
'websrv': [test_websrv]
};
config.modules2test.filter(function (module) { return config.modules.indexOf(module) > -1}).forEach(function (module) {
tests[module].forEach(function (test) {
test.call();
});
});
console.log("Module 'tester' loaded");
};
function test_search_simple() {
require('request')(host + 'find?search=simple&text=Miranda', function (err, res, body) {
//p(err)
//JSON.parse(body).map(function (ref) {
// p(ref);
//});
});
}
function test_search_advanced() {
require('request')(host + 'find?search=advanced&author=Penev&year=2010&origin=ZooKeys', function (err, res, body) {
//p(body)
//JSON.parse(body).map(function (ref) {
// p(ref);
//});
});
}
function test_format() {
var ref = {
"authors": [
["Noel Fcc", "de Miranda"],
["Roujun", "Peng"],
["Konstantinos", "Georgiou"],
["Chenglin", "Wu"],
["Elin Falk", "Sorqvist"],
["Mattias", "Berglund"],
["Longyun", "Chen"],
["Zhibo", "Gao"],
["Kristina", "Lagerstedt"],
["Susana", "Lisboa"],
["Fredrik", "Roos"],
["Tom", "van Wezel"],
["Manuel R", "Teixeira"],
["Richard", "Rosenquist"],
["Christer", "Sundstrom"],
["Gunilla", "Enblad"],
["Mats", "Nilsson"],
["Yixin", "Zeng"],
["David", "Kipling"],
["Qiang", "Pan-Hammarstrom"]
],
"doi": "10.1084/jem.20122842",
"href": "http://dx.doi.org/10.1084/jem.20122842",
"title": "DNA repair genes are selectively mutated in diffuse large B cell lymphomas.",
"year": "2013",
"publishedIn": "The Journal of experimental medicine",
"firstauthor": [
"Noel Fcc", "de Miranda"
],
"isParsed": true,
"id": {
"pubmed": "23960188"
}
},
style = 'zookeys'; // 'foerster-geisteswissenschaft';
require('request')(host + 'format?style=' + style + '&ref=' + encodeURIComponent(JSON.stringify(ref)), function (err, res, body) {
//p(body);
});
}
function test_websrv() {
require('request')(host + 'index.html', function (err, res, body) {
//p(body);
});
}