Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianBZG committed Feb 20, 2020
1 parent a40ae7a commit 4850d68
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 203 deletions.
2 changes: 1 addition & 1 deletion bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var server = http.createServer(app);
* Listen on provided port, on all network interfaces.
*/

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

Expand Down
120 changes: 60 additions & 60 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
{
"title": "InterMine Data Brpwser",
"name": "intermine-data-browser",
"version": "1.1.0",
"description": "A web-based data browser for InterMine",
"homepage": "https://github.com/InterMine/InterMine-Data-Browser-Tool",
"bugs": {
"url": "https://github.com/InterMine/InterMine-Data-Browser-Tool/issues",
"email": "adrianrodriguezbazaga@gmail.com"
},
"scripts": {
"start": "gulp & node ./bin/www",
"dev": "gulp && webpack --config webpack.config.js",
"test": "mocha --timeout 100000"
},
"author": "Adrian Rodriguez-Bazaga",
"contributors": [
"Yo Yehudi",
"Rachel Lyne",
"LarkhSingla",
"Divyanshu Mahajan",
"Ankit Kumar",
"Nikhil Vats",
"Himanshu Singh",
"Varun Bhandia",
"holloh",
"himanshuc3"
],
"repository": {
"type": "git",
"url": "https://github.com/InterMine/InterMine-Data-Browser-Tool"
},
"dependencies": {
"JSONStream": "^1.3.5",
"bootstrap": "^4.4.1",
"chart.js": "^2.9.3",
"cookie-parser": "~1.4.3",
"datatables.net-bs4": "1.10.16",
"debug": "~2.6.9",
"es6-promise": "^4.2.8",
"express": "^4.16.3",
"font-awesome": "4.7.0",
"gulp": "^4.0.2",
"gulp-clean-css": "^4.2.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^3.1.0",
"http-errors": "~1.6.2",
"imjs": "^3.15.1",
"jquery": "^3.4.1",
"jquery.easing": "^1.4.1",
"jsdom": "^11.11.0",
"morgan": "~1.9.0",
"open": "^7.0.2",
"pug": "^2.0.4"
},
"devDependencies": {
"browser-sync": "^2.26.7",
"chai": "^4.1.2",
"chai-http": "^4.0.0",
"mocha": "^5.2.0"
}
"title": "InterMine Data Brpwser",
"name": "intermine-data-browser",
"version": "1.1.0",
"description": "A web-based data browser for InterMine",
"homepage": "https://github.com/InterMine/InterMine-Data-Browser-Tool",
"bugs": {
"url": "https://github.com/InterMine/InterMine-Data-Browser-Tool/issues",
"email": "adrianrodriguezbazaga@gmail.com"
},
"scripts": {
"start": "gulp & node ./bin/www",
"dev": "gulp && webpack --config webpack.config.js",
"test": "mocha --timeout 100000"
},
"author": "Adrian Rodriguez-Bazaga",
"contributors": [
"Yo Yehudi",
"Rachel Lyne",
"LarkhSingla",
"Divyanshu Mahajan",
"Ankit Kumar",
"Nikhil Vats",
"Himanshu Singh",
"Varun Bhandia",
"holloh",
"himanshuc3"
],
"repository": {
"type": "git",
"url": "https://github.com/InterMine/InterMine-Data-Browser-Tool"
},
"dependencies": {
"JSONStream": "^1.3.5",
"bootstrap": "^4.4.1",
"chart.js": "^2.9.3",
"cookie-parser": "~1.4.3",
"datatables.net-bs4": "1.10.16",
"debug": "~2.6.9",
"es6-promise": "^4.2.8",
"express": "^4.16.3",
"font-awesome": "4.7.0",
"gulp": "^4.0.2",
"gulp-clean-css": "^4.2.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^3.1.0",
"http-errors": "~1.6.2",
"imjs": "^3.18.1",
"jquery": "^3.4.1",
"jquery.easing": "^1.4.1",
"jsdom": "^11.11.0",
"morgan": "~1.9.0",
"open": "^7.0.2",
"pug": "^2.0.4"
},
"devDependencies": {
"browser-sync": "^2.26.7",
"chai": "^4.1.2",
"chai-http": "^4.0.0",
"mocha": "^5.2.0"
}
}
169 changes: 28 additions & 141 deletions test/api-requests-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,152 +5,39 @@ let chai = require('chai');
let chaiHttp = require('chai-http');
let server = require('../app');
let should = chai.should();
let intermine = require('imjs');

chai.use(chaiHttp);

describe('Fetch', () => {
describe('/GET listing of ontology terms of HumanMine primary classes', () => {
it('it should GET the listing of ontology terms inside class Protein in HumanMine', (done) => {
chai.request(server)
.get('/fetch/ontologyterms/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Protein')
.end((err, res) => {
res.should.have.status(200);
res.body.results.should.be.a('array');
res.body.results.length.should.be.at.least(1);
done();
});
});

it('it should GET the listing of ontology terms inside class Gene in HumanMine', (done) => {
chai.request(server)
.get('/fetch/ontologyterms/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
.end((err, res) => {
res.should.have.status(200);
res.body.results.should.be.a('array');
res.body.results.length.should.be.at.least(1);
done();
});
});

it('it should GET the listing of dataset names inside class Protein in HumanMine', (done) => {
chai.request(server)
.get('/fetch/datasets/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Protein')
.end((err, res) => {
res.should.have.status(200);
res.body.results.should.be.a('array');
res.body.results.length.should.be.at.least(1);
done();
});
});

it('it should GET the listing of dataset names inside class Gene in HumanMine', (done) => {
chai.request(server)
.get('/fetch/datasets/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
.end((err, res) => {
res.should.have.status(200);
res.body.results.should.be.a('array');
res.body.results.length.should.be.at.least(1);
done();
});
});

it('it should GET the listing of pathway names inside class Protein in HumanMine', (done) => {
chai.request(server)
.get('/fetch/pathways/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Protein')
.end((err, res) => {
res.should.have.status(200);
res.body.results.should.be.a('array');
res.body.results.length.should.be.at.least(1);
done();
});
});

it('it should GET the listing of pathway names inside class Gene in HumanMine', (done) => {
chai.request(server)
.get('/fetch/pathways/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
.end((err, res) => {
res.should.have.status(200);
res.body.results.should.be.a('array');
res.body.results.length.should.be.at.least(1);
done();
});
});

it('it should GET the listing of protein domain names inside HumanMine', (done) => {
chai.request(server)
.get('/fetch/proteindomainname/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice')
.end((err, res) => {
res.should.have.status(200);
res.body.results.should.be.a('array');
res.body.results.length.should.be.at.least(1);
done();
});
});

it('it should GET the listing of Participant 2 Gene symbols inside HumanMine', (done) => {
chai.request(server)
.get('/fetch/participant2genesymbols/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice')
.end((err, res) => {
res.should.have.status(200);
res.body.results.should.be.a('array');
res.body.results.length.should.be.at.least(1);
done();
});
});

it('it should GET the listing of Diseases Names inside HumanMine', (done) => {
chai.request(server)
.get('/fetch/diseases/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
.end((err, res) => {
res.should.have.status(200);
res.body.results.should.be.a('array');
res.body.results.length.should.be.at.least(1);
done();
});
});

it('it should GET the listing of Alleles types inside HumanMine', (done) => {
chai.request(server)
.get('/fetch/allelestype/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
.end((err, res) => {
res.should.have.status(200);
res.body.results.should.be.a('array');
res.body.results.length.should.be.at.least(1);
done();
});
});

it('it should GET the listing of Alleles Clinical Significance inside HumanMine', (done) => {
chai.request(server)
.get('/fetch/clinicalsignificance/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
.end((err, res) => {
res.should.have.status(200);
res.body.results.should.be.a('array');
res.body.results.length.should.be.at.least(1);
done();
});
});
describe('API requests using imjs', () => {
describe('/Obtain pathway names in a given class should not be empty', () => {
it('it should get the pathway names inside class Gene in HumanMine', (done) => {

var service = new intermine.Service({
root: "https://www.humanmine.org/humanmine/service"
});

it('it should GET the listing of Protein Atlas Expression Cell Types inside HumanMine', (done) => {
chai.request(server)
.get('/fetch/proteinatlascelltypes/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
.end((err, res) => {
res.should.have.status(200);
res.body.results.should.be.a('array');
res.body.results.length.should.be.at.least(1);
done();
});
});
var query = {
"from": "Gene",
"select": ["pathways.name", "primaryIdentifier"],
"model": {
"name": "genomic"
},
"orderBy": [{
"path": "pathways.name",
"direction": "ASC"
}]
};

var pathways = new intermine.Query(query, service),
pathwaysPath = [query.from, query.select[0]].join('.');
pathways.summarize(pathwaysPath).then(function(pathwaySummary) {
//This returns the pathway name and the number of gene rows associated with the pathway
pathwaySummary.should.be.a('array');
pathwaySummary.length.should.be.at.least(1);
done();
});

it('it should GET the listing of Protein Atlas Expression Tissue Names inside HumanMine', (done) => {
chai.request(server)
.get('/fetch/proteinatlastissuenames/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene')
.end((err, res) => {
res.should.have.status(200);
res.body.results.should.be.a('array');
res.body.results.length.should.be.at.least(1);
done();
});
});
});
});
2 changes: 1 addition & 1 deletion views/includes/js/core.pug
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
script(src='https://cdn.rawgit.com/intermine/CDN/feb5bb77/js/intermine/imjs/3.15.0/im.min.js')
script(src='http://cdn.intermine.org/js/intermine/im-tables/2.0.0-beta/imtables.js')
script(src='https://cdn.jsdelivr.net/gh/intermine/CDN@feb5bb77caa5f1f6c44bd15f4f132de385294c2c/js/intermine/imjs/3.15.0/im.min.js')
script(src='vendor/chart.js/Chart.min.js')
script(src='//code.jquery.com/jquery-1.11.1.min.js')
script(src='https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.bundle.min.js')
Expand Down

0 comments on commit 4850d68

Please sign in to comment.