Skip to content

Commit 4850d68

Browse files
committed
Update tests
1 parent a40ae7a commit 4850d68

File tree

4 files changed

+90
-203
lines changed

4 files changed

+90
-203
lines changed

bin/www

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var server = http.createServer(app);
2525
* Listen on provided port, on all network interfaces.
2626
*/
2727

28-
server.listen(port, () => console.log(`Server Started: http://localhost:${port}`));
28+
server.listen(port, () => console.log(`Server started on http://localhost:${port}`));
2929
server.on('error', onError);
3030
server.on('listening', onListening);
3131

package.json

+60-60
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
11
{
2-
"title": "InterMine Data Brpwser",
3-
"name": "intermine-data-browser",
4-
"version": "1.1.0",
5-
"description": "A web-based data browser for InterMine",
6-
"homepage": "https://github.com/InterMine/InterMine-Data-Browser-Tool",
7-
"bugs": {
8-
"url": "https://github.com/InterMine/InterMine-Data-Browser-Tool/issues",
9-
"email": "[email protected]"
10-
},
11-
"scripts": {
12-
"start": "gulp & node ./bin/www",
13-
"dev": "gulp && webpack --config webpack.config.js",
14-
"test": "mocha --timeout 100000"
15-
},
16-
"author": "Adrian Rodriguez-Bazaga",
17-
"contributors": [
18-
"Yo Yehudi",
19-
"Rachel Lyne",
20-
"LarkhSingla",
21-
"Divyanshu Mahajan",
22-
"Ankit Kumar",
23-
"Nikhil Vats",
24-
"Himanshu Singh",
25-
"Varun Bhandia",
26-
"holloh",
27-
"himanshuc3"
28-
],
29-
"repository": {
30-
"type": "git",
31-
"url": "https://github.com/InterMine/InterMine-Data-Browser-Tool"
32-
},
33-
"dependencies": {
34-
"JSONStream": "^1.3.5",
35-
"bootstrap": "^4.4.1",
36-
"chart.js": "^2.9.3",
37-
"cookie-parser": "~1.4.3",
38-
"datatables.net-bs4": "1.10.16",
39-
"debug": "~2.6.9",
40-
"es6-promise": "^4.2.8",
41-
"express": "^4.16.3",
42-
"font-awesome": "4.7.0",
43-
"gulp": "^4.0.2",
44-
"gulp-clean-css": "^4.2.0",
45-
"gulp-rename": "^1.2.2",
46-
"gulp-sass": "^3.1.0",
47-
"http-errors": "~1.6.2",
48-
"imjs": "^3.15.1",
49-
"jquery": "^3.4.1",
50-
"jquery.easing": "^1.4.1",
51-
"jsdom": "^11.11.0",
52-
"morgan": "~1.9.0",
53-
"open": "^7.0.2",
54-
"pug": "^2.0.4"
55-
},
56-
"devDependencies": {
57-
"browser-sync": "^2.26.7",
58-
"chai": "^4.1.2",
59-
"chai-http": "^4.0.0",
60-
"mocha": "^5.2.0"
61-
}
2+
"title": "InterMine Data Brpwser",
3+
"name": "intermine-data-browser",
4+
"version": "1.1.0",
5+
"description": "A web-based data browser for InterMine",
6+
"homepage": "https://github.com/InterMine/InterMine-Data-Browser-Tool",
7+
"bugs": {
8+
"url": "https://github.com/InterMine/InterMine-Data-Browser-Tool/issues",
9+
"email": "[email protected]"
10+
},
11+
"scripts": {
12+
"start": "gulp & node ./bin/www",
13+
"dev": "gulp && webpack --config webpack.config.js",
14+
"test": "mocha --timeout 100000"
15+
},
16+
"author": "Adrian Rodriguez-Bazaga",
17+
"contributors": [
18+
"Yo Yehudi",
19+
"Rachel Lyne",
20+
"LarkhSingla",
21+
"Divyanshu Mahajan",
22+
"Ankit Kumar",
23+
"Nikhil Vats",
24+
"Himanshu Singh",
25+
"Varun Bhandia",
26+
"holloh",
27+
"himanshuc3"
28+
],
29+
"repository": {
30+
"type": "git",
31+
"url": "https://github.com/InterMine/InterMine-Data-Browser-Tool"
32+
},
33+
"dependencies": {
34+
"JSONStream": "^1.3.5",
35+
"bootstrap": "^4.4.1",
36+
"chart.js": "^2.9.3",
37+
"cookie-parser": "~1.4.3",
38+
"datatables.net-bs4": "1.10.16",
39+
"debug": "~2.6.9",
40+
"es6-promise": "^4.2.8",
41+
"express": "^4.16.3",
42+
"font-awesome": "4.7.0",
43+
"gulp": "^4.0.2",
44+
"gulp-clean-css": "^4.2.0",
45+
"gulp-rename": "^1.2.2",
46+
"gulp-sass": "^3.1.0",
47+
"http-errors": "~1.6.2",
48+
"imjs": "^3.18.1",
49+
"jquery": "^3.4.1",
50+
"jquery.easing": "^1.4.1",
51+
"jsdom": "^11.11.0",
52+
"morgan": "~1.9.0",
53+
"open": "^7.0.2",
54+
"pug": "^2.0.4"
55+
},
56+
"devDependencies": {
57+
"browser-sync": "^2.26.7",
58+
"chai": "^4.1.2",
59+
"chai-http": "^4.0.0",
60+
"mocha": "^5.2.0"
61+
}
6262
}

test/api-requests-test.js

+28-141
Original file line numberDiff line numberDiff line change
@@ -5,152 +5,39 @@ let chai = require('chai');
55
let chaiHttp = require('chai-http');
66
let server = require('../app');
77
let should = chai.should();
8+
let intermine = require('imjs');
89

910
chai.use(chaiHttp);
1011

11-
describe('Fetch', () => {
12-
describe('/GET listing of ontology terms of HumanMine primary classes', () => {
13-
it('it should GET the listing of ontology terms inside class Protein in HumanMine', (done) => {
14-
chai.request(server)
15-
.get('/fetch/ontologyterms/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Protein')
16-
.end((err, res) => {
17-
res.should.have.status(200);
18-
res.body.results.should.be.a('array');
19-
res.body.results.length.should.be.at.least(1);
20-
done();
21-
});
22-
});
23-
24-
it('it should GET the listing of ontology terms inside class Gene in HumanMine', (done) => {
25-
chai.request(server)
26-
.get('/fetch/ontologyterms/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
27-
.end((err, res) => {
28-
res.should.have.status(200);
29-
res.body.results.should.be.a('array');
30-
res.body.results.length.should.be.at.least(1);
31-
done();
32-
});
33-
});
34-
35-
it('it should GET the listing of dataset names inside class Protein in HumanMine', (done) => {
36-
chai.request(server)
37-
.get('/fetch/datasets/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Protein')
38-
.end((err, res) => {
39-
res.should.have.status(200);
40-
res.body.results.should.be.a('array');
41-
res.body.results.length.should.be.at.least(1);
42-
done();
43-
});
44-
});
45-
46-
it('it should GET the listing of dataset names inside class Gene in HumanMine', (done) => {
47-
chai.request(server)
48-
.get('/fetch/datasets/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
49-
.end((err, res) => {
50-
res.should.have.status(200);
51-
res.body.results.should.be.a('array');
52-
res.body.results.length.should.be.at.least(1);
53-
done();
54-
});
55-
});
56-
57-
it('it should GET the listing of pathway names inside class Protein in HumanMine', (done) => {
58-
chai.request(server)
59-
.get('/fetch/pathways/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Protein')
60-
.end((err, res) => {
61-
res.should.have.status(200);
62-
res.body.results.should.be.a('array');
63-
res.body.results.length.should.be.at.least(1);
64-
done();
65-
});
66-
});
67-
68-
it('it should GET the listing of pathway names inside class Gene in HumanMine', (done) => {
69-
chai.request(server)
70-
.get('/fetch/pathways/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
71-
.end((err, res) => {
72-
res.should.have.status(200);
73-
res.body.results.should.be.a('array');
74-
res.body.results.length.should.be.at.least(1);
75-
done();
76-
});
77-
});
78-
79-
it('it should GET the listing of protein domain names inside HumanMine', (done) => {
80-
chai.request(server)
81-
.get('/fetch/proteindomainname/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice')
82-
.end((err, res) => {
83-
res.should.have.status(200);
84-
res.body.results.should.be.a('array');
85-
res.body.results.length.should.be.at.least(1);
86-
done();
87-
});
88-
});
89-
90-
it('it should GET the listing of Participant 2 Gene symbols inside HumanMine', (done) => {
91-
chai.request(server)
92-
.get('/fetch/participant2genesymbols/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice')
93-
.end((err, res) => {
94-
res.should.have.status(200);
95-
res.body.results.should.be.a('array');
96-
res.body.results.length.should.be.at.least(1);
97-
done();
98-
});
99-
});
100-
101-
it('it should GET the listing of Diseases Names inside HumanMine', (done) => {
102-
chai.request(server)
103-
.get('/fetch/diseases/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
104-
.end((err, res) => {
105-
res.should.have.status(200);
106-
res.body.results.should.be.a('array');
107-
res.body.results.length.should.be.at.least(1);
108-
done();
109-
});
110-
});
111-
112-
it('it should GET the listing of Alleles types inside HumanMine', (done) => {
113-
chai.request(server)
114-
.get('/fetch/allelestype/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
115-
.end((err, res) => {
116-
res.should.have.status(200);
117-
res.body.results.should.be.a('array');
118-
res.body.results.length.should.be.at.least(1);
119-
done();
120-
});
121-
});
122-
123-
it('it should GET the listing of Alleles Clinical Significance inside HumanMine', (done) => {
124-
chai.request(server)
125-
.get('/fetch/clinicalsignificance/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
126-
.end((err, res) => {
127-
res.should.have.status(200);
128-
res.body.results.should.be.a('array');
129-
res.body.results.length.should.be.at.least(1);
130-
done();
131-
});
132-
});
12+
describe('API requests using imjs', () => {
13+
describe('/Obtain pathway names in a given class should not be empty', () => {
14+
it('it should get the pathway names inside class Gene in HumanMine', (done) => {
15+
16+
var service = new intermine.Service({
17+
root: "https://www.humanmine.org/humanmine/service"
18+
});
13319

134-
it('it should GET the listing of Protein Atlas Expression Cell Types inside HumanMine', (done) => {
135-
chai.request(server)
136-
.get('/fetch/proteinatlascelltypes/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
137-
.end((err, res) => {
138-
res.should.have.status(200);
139-
res.body.results.should.be.a('array');
140-
res.body.results.length.should.be.at.least(1);
141-
done();
142-
});
143-
});
20+
var query = {
21+
"from": "Gene",
22+
"select": ["pathways.name", "primaryIdentifier"],
23+
"model": {
24+
"name": "genomic"
25+
},
26+
"orderBy": [{
27+
"path": "pathways.name",
28+
"direction": "ASC"
29+
}]
30+
};
31+
32+
var pathways = new intermine.Query(query, service),
33+
pathwaysPath = [query.from, query.select[0]].join('.');
34+
pathways.summarize(pathwaysPath).then(function(pathwaySummary) {
35+
//This returns the pathway name and the number of gene rows associated with the pathway
36+
pathwaySummary.should.be.a('array');
37+
pathwaySummary.length.should.be.at.least(1);
38+
done();
39+
});
14440

145-
it('it should GET the listing of Protein Atlas Expression Tissue Names inside HumanMine', (done) => {
146-
chai.request(server)
147-
.get('/fetch/proteinatlastissuenames/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
148-
.end((err, res) => {
149-
res.should.have.status(200);
150-
res.body.results.should.be.a('array');
151-
res.body.results.length.should.be.at.least(1);
152-
done();
153-
});
15441
});
15542
});
15643
});

views/includes/js/core.pug

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
script(src='https://cdn.rawgit.com/intermine/CDN/feb5bb77/js/intermine/imjs/3.15.0/im.min.js')
21
script(src='http://cdn.intermine.org/js/intermine/im-tables/2.0.0-beta/imtables.js')
2+
script(src='https://cdn.jsdelivr.net/gh/intermine/CDN@feb5bb77caa5f1f6c44bd15f4f132de385294c2c/js/intermine/imjs/3.15.0/im.min.js')
33
script(src='vendor/chart.js/Chart.min.js')
44
script(src='//code.jquery.com/jquery-1.11.1.min.js')
55
script(src='https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.bundle.min.js')

0 commit comments

Comments
 (0)