Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/tests.html

Large diffs are not rendered by default.

5,946 changes: 2,971 additions & 2,975 deletions public/tests.json

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions test/assays.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
'use strict';
const expect = require('chai').expect;
const supertest = require('supertest');

const dotenv = require('dotenv');
dotenv.config();

let testroute = process.env.APIPORT;

if (typeof process.env.APIPATH === 'undefined') {
testroute = 'http://localhost:' + process.env.APIPORT + '/';
} else {
testroute = process.env.APIPATH;
}

const api = supertest(testroute);

// *************************************************
// aeDNA assay data:
//
// This lives outside test/v*.js on purpose: genoatt.sh deletes and regenerates
// those from openapi.yaml, and the generated tests only ever assert a status
// code. The assay payload feeds the FAIRe exporter's projectMetadata sheet, so
// a field silently dropped from assaysbydataset.sql would surface there as a
// blank cell rather than as a failure.

describe('Get aeDNA assays by datasetid:', function() {
this.timeout(5000);

it('every assay carries the FAIRe project terms:', function(done) {
api.get('v2.0/data/datasets/74666/assays')
.set('Accept', 'application/json')
.expect(200)
.expect(function(res) {
const assays = res.body.data.assays;
expect(assays).to.be.an('array');
assays.forEach(function(assay) {
// sterilise_method / neg_cont / pos_cont -> projectMetadata D6/D7/D8.
expect(assay).to.have.property('sterilisemethod');
expect(assay).to.have.property('negcont');
expect(assay).to.have.property('poscont');
});
})
.end(done);
});

it('a dataset with no assays returns an empty array, not an error:', function(done) {
api.get('v2.0/data/datasets/500/assays')
.set('Accept', 'application/json')
.expect(200)
.expect(function(res) {
expect(res.body.data.assays).to.be.an('array');
})
.end(done);
});
});
2 changes: 1 addition & 1 deletion test/v1.5-data-contacts-{contactid}-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var expect = chakram.expect;
describe('tests for /v1.5/data/contacts/{contactid}', function() {
describe('tests for get', function() {
it('should respond 200 for "Contact"', function() {
var response = request('get', 'http://localhost:3001/v1.5/data/contacts/-2097676', {
var response = request('get', 'http://localhost:3001/v1.5/data/contacts/-90664163', {
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v1.5-data-geopoliticalunits-{gpid}-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var expect = chakram.expect;
describe('tests for /v1.5/data/geopoliticalunits/{gpid}', function() {
describe('tests for get', function() {
it('should respond 200 for "An array of geopolitical units."', function() {
var response = request('get', 'http://localhost:3001/v1.5/data/geopoliticalunits/7972', {
var response = request('get', 'http://localhost:3001/v1.5/data/geopoliticalunits/4789', {
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-apps-constdb-datasetages-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/apps/constdb/datasetages', function() {
describe('tests for get', function() {
it('should respond 200 for "Returns an ordered array (from earliest to latest) of upload counts by month (YYYY/MM/DD; all days as 01). Months with no uploads are excluded. "', function() {
var response = request('get', 'http://localhost:3001/v2.0/apps/constdb/datasetages', {
'qs': {"dbid":25},
'qs': {"dbid":20},
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-apps-constdb-datasets-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/apps/constdb/datasets', function() {
describe('tests for get', function() {
it('should respond 200 for "Returns the set of datasets contained within a constituent database, identified by the constituent database identifier. Used for quick landing page generation. "', function() {
var response = request('get', 'http://localhost:3001/v2.0/apps/constdb/datasets', {
'qs': {"dbid":7},
'qs': {"dbid":26},
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-apps-constdb-datasetuploads-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/apps/constdb/datasetuploads', function() {
describe('tests for get', function() {
it('should respond 200 for "Returns an ordered array (from earliest to latest) of upload counts by month (YYYY/MM/DD; all days as 01). Months with no uploads are excluded. "', function() {
var response = request('get', 'http://localhost:3001/v2.0/apps/constdb/datasetuploads', {
'qs': {"dbid":2},
'qs': {"dbid":25},
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-apps-depenvt-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/apps/depenvt', function() {
describe('tests for get', function() {
it('should respond 200 for "This returns the information about depositional environment for selected dataset/collection unit/site."', function() {
var response = request('get', 'http://localhost:3001/v2.0/apps/depenvt', {
'qs': {"siteid":8235,"datasetid":12990720,"collectionunitid":17491},
'qs': {"siteid":1610,"datasetid":80118037,"collectionunitid":46745},
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-apps-taphonomysystems-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/apps/taphonomysystems', function() {
describe('tests for get', function() {
it('should respond 200 for "A table of Neotoma collection types."', function() {
var response = request('get', 'http://localhost:3001/v2.0/apps/taphonomysystems', {
'qs': {"datasettypeid":40},
'qs': {"datasettypeid":30},
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-contacts-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/data/contacts', function() {
describe('tests for get', function() {
it('should respond 200 for "contact"', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/contacts', {
'qs': {"contactid":2387,"familyname":"nU","contactname":"WwCt O'dJBx","contactstatus":"defunct","limit": 10,"offset": 0},
'qs': {"contactid":5583,"familyname":"Uum-WPAgUA","contactname":"m","contactstatus":"unknown","limit": 10,"offset": 0},
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-contacts-{contactid}-publications-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var expect = chakram.expect;
describe('tests for /v2.0/data/contacts/{contactid}/publications', function() {
describe('tests for get', function() {
it('should respond 200 for "An array of publications associated with the contact."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/contacts/2594/publications', {
var response = request('get', 'http://localhost:3001/v2.0/data/contacts/500/publications', {
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-contacts-{contactid}-sites-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var expect = chakram.expect;
describe('tests for /v2.0/data/contacts/{contactid}/sites', function() {
describe('tests for get', function() {
it('should respond 200 for "A Neotoma sites object."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/contacts/6889/sites', {
var response = request('get', 'http://localhost:3001/v2.0/data/contacts/9929/sites', {
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-contacts-{contactid}-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var expect = chakram.expect;
describe('tests for /v2.0/data/contacts/{contactid}', function() {
describe('tests for get', function() {
it('should respond 200 for "A Neotoma contacts object."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/contacts/8026', {
var response = request('get', 'http://localhost:3001/v2.0/data/contacts/500', {
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-datasets-db-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/data/datasets/db', function() {
describe('tests for get', function() {
it('should respond 200 for "Datasets"', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/datasets/db', {
'qs': {"limit": 10,"offset": 0,"database":"Diatom Paleolimnology Data Cooperative (DPDC)"},
'qs': {"limit": 10,"offset": 0,"database":"Neotoma Testate Amoebae Database"},
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-datasets-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/data/datasets', function() {
describe('tests for get', function() {
it('should respond 200 for "An array of datasets."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/datasets', {
'qs': {"sitename":"ea reprehenderit Duis exercitation","database":"FAUNMAP","datasettype":"specimen stable isotope","altmin": 10,"altmax": 100,"loc":"{\"type\":\"Polygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[13.4,55.92],[13.5,55.92],[13.5,55.95],[13.4,55.95],[13.4,55.92]]]}","siteid":1671,"datasetid":33225555,"doi":"10F3028263/I","gpid":5392,"keyword":"beyond radiocarbon","contactid":952,"taxa":"occaecat ut elit est et","ageyoung": 1000,"ageold": 10000,"ageof":21061821,"limit": 10,"offset": 0},
'qs': {"sitename":"in nisi amet deserunt ea","database":"Chinese Pollen Database","datasettype":"chironomid","altmin": 10,"altmax": 100,"loc":"{\"type\":\"Polygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[13.4,55.92],[13.5,55.92],[13.5,55.95],[13.4,55.95],[13.4,55.92]]]}","siteid":26747,"datasetid":69182564,"doi":"10A45156150/-","gpid":5392,"keyword":"bottom","contactid":6816,"taxa":"adipisicing laborum deserunt sunt","ageyoung": 1000,"ageold": 10000,"ageof":1987576,"limit": 10,"offset": 0},
'time': true
});

Expand Down
19 changes: 19 additions & 0 deletions test/v2.0-data-datasets-{datasetid}-assays-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';
var mocha = require('mocha');
var chakram = require('chakram');
var request = chakram.request;
var expect = chakram.expect;

describe('tests for /v2.0/data/datasets/{datasetid}/assays', function() {
describe('tests for get', function() {
it('should respond 200 for "Assays"', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/datasets/500/assays', {
'time': true
});

expect(response).to.have.status(200);
return chakram.wait();
});

});
});
19 changes: 19 additions & 0 deletions test/v2.0-data-datasets-{datasetid}-projects-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';
var mocha = require('mocha');
var chakram = require('chakram');
var request = chakram.request;
var expect = chakram.expect;

describe('tests for /v2.0/data/datasets/{datasetid}/projects', function() {
describe('tests for get', function() {
it('should respond 200 for "Projects"', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/datasets/500/projects', {
'time': true
});

expect(response).to.have.status(200);
return chakram.wait();
});

});
});
2 changes: 1 addition & 1 deletion test/v2.0-data-datasets_elc-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/data/datasets_elc', function() {
describe('tests for get', function() {
it('should respond 200 for "A Neotoma datasets object suitable for the EarthLife Consortium API."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/datasets_elc', {
'qs': {"siteid":7265,"contactid":10455,"datasettype":"geochronologic","altmin": 10,"altmax": 100,"loc":"{\"type\":\"Polygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[13.4,55.92],[13.5,55.92],[13.5,55.95],[13.4,55.95],[13.4,55.92]]]}","ageyoung": 1000,"ageold": 10000,"ageof":16732658},
'qs': {"siteid":24832,"contactid":6896,"datasettype":"geochemistry","altmin": 10,"altmax": 100,"loc":"{\"type\":\"Polygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[13.4,55.92],[13.5,55.92],[13.5,55.95],[13.4,55.95],[13.4,55.92]]]}","ageyoung": 1000,"ageold": 10000,"ageof":6017958},
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-dbtables-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/data/dbtables', function() {
describe('tests for get', function() {
it('should respond 200 for "Returned table."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/dbtables', {
'qs': {"table":"voluptate pariatur","count":true,"limit": 10,"offset": 0},
'qs': {"table":"fugiat","count":false,"limit": 10,"offset": 0},
'time': true
});

Expand Down
4 changes: 2 additions & 2 deletions test/v2.0-data-dbtables-{table}-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ var expect = chakram.expect;
describe('tests for /v2.0/data/dbtables/{table}', function() {
describe('tests for get', function() {
it('should respond 200 for "Returned table."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/dbtables/minimLoremExcepteur', {
'qs': {"count":true,"limit": 10,"offset": 0},
var response = request('get', 'http://localhost:3001/v2.0/data/dbtables/deseruntaliquapariatur', {
'qs': {"count":false,"limit": 10,"offset": 0},
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-geopoliticalunits-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/data/geopoliticalunits', function() {
describe('tests for get', function() {
it('should respond 200 for "An array of geopolitical units."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/geopoliticalunits', {
'qs': {"gpid":5392,"gpname":"Canada","rank":2,"lower":false},
'qs': {"gpid":5392,"gpname":"Canada","rank":4,"lower":true},
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-geopoliticalunits-{gpid}-datasets-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var expect = chakram.expect;
describe('tests for /v2.0/data/geopoliticalunits/{gpid}/datasets', function() {
describe('tests for get', function() {
it('should respond 200 for "An array of datasets."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/geopoliticalunits/90/datasets', {
var response = request('get', 'http://localhost:3001/v2.0/data/geopoliticalunits/500/datasets', {
'qs': {"limit": 10,"offset": 0},
'time': true
});
Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-geopoliticalunits-{gpid}-sites-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var expect = chakram.expect;
describe('tests for /v2.0/data/geopoliticalunits/{gpid}/sites', function() {
describe('tests for get', function() {
it('should respond 200 for "An array of sites."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/geopoliticalunits/4371/sites', {
var response = request('get', 'http://localhost:3001/v2.0/data/geopoliticalunits/1467/sites', {
'qs': {"limit": 10,"offset": 0},
'time': true
});
Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-geopoliticalunits-{gpid}-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var expect = chakram.expect;
describe('tests for /v2.0/data/geopoliticalunits/{gpid}', function() {
describe('tests for get', function() {
it('should respond 200 for "An array of geopolitical units."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/geopoliticalunits/4982', {
var response = request('get', 'http://localhost:3001/v2.0/data/geopoliticalunits/5778', {
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-occurrences-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/data/occurrences', function() {
describe('tests for get', function() {
it('should respond 200 for "occurrence"', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/occurrences', {
'qs': {"taxonname":"occaecat cupidatat labore sunt ad","taxonid":20557,"siteid":41770,"sitename":"et","datasettype":"geochemistry","altmin": 10,"altmax": 100,"loc":"{\"type\":\"Polygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[13.4,55.92],[13.5,55.92],[13.5,55.95],[13.4,55.95],[13.4,55.92]]]}","ageof":10629033,"ageyoung": 1000,"ageold": 10000,"limit": 10,"offset": 0},
'qs': {"taxonname":"magna irure anim consectetur ullamco","taxonid":21012,"siteid":49855,"sitename":"mollit","datasettype":"stable isotope","altmin": 10,"altmax": 100,"loc":"{\"type\":\"Polygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[13.4,55.92],[13.5,55.92],[13.5,55.95],[13.4,55.95],[13.4,55.92]]]}","ageof":2647566,"ageyoung": 1000,"ageold": 10000,"limit": 10,"offset": 0},
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-pollen-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/data/pollen', function() {
describe('tests for get', function() {
it('should respond 200 for "A record of all pollen samples in time/space for a particular taxon."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/pollen', {
'qs': {"taxonname":"dolor proident dolore cillum","taxonid":45760,"siteid":7899,"sitename":"fugiat eiusmod","datasettype":"macroinvertebrate","altmin": 10,"altmax": 100,"loc":"{\"type\":\"Polygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[13.4,55.92],[13.5,55.92],[13.5,55.95],[13.4,55.95],[13.4,55.92]]]}","ageof":3490473,"ageyoung": 1000,"ageold": 10000,"limit": 10,"offset": 0},
'qs': {"taxonname":"et ad non irure quis","taxonid":45362,"siteid":39084,"sitename":"eiusmod esse ipsum","datasettype":"geochronologic","altmin": 10,"altmax": 100,"loc":"{\"type\":\"Polygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[13.4,55.92],[13.5,55.92],[13.5,55.95],[13.4,55.95],[13.4,55.92]]]}","ageof":5395162,"ageyoung": 1000,"ageold": 10000,"limit": 10,"offset": 0},
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-pollen-{id}-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var expect = chakram.expect;
describe('tests for /v2.0/data/pollen/{id}', function() {
describe('tests for get', function() {
it('should respond 200 for "A record of all pollen samples in time/space for a particular taxon."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/pollen/9055', {
var response = request('get', 'http://localhost:3001/v2.0/data/pollen/500', {
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-publications-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('tests for /v2.0/data/publications', function() {
describe('tests for get', function() {
it('should respond 200 for "A list of publications."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/publications', {
'qs': {"publicationid":1255,"datasetid":13617827,"siteid":44696,"familyname":"MpTf-oof","pubtype":"Book Chapter","year":1521,"search":"ad veniam occaecat","limit": 10,"offset": 0},
'qs': {"publicationid":3227,"datasetid":62171686,"siteid":15473,"familyname":"Tm-","pubtype":"Other Edited","year":1958,"search":"dolor laboris ullamco ut","limit": 10,"offset": 0},
'time': true
});

Expand Down
2 changes: 1 addition & 1 deletion test/v2.0-data-publications-{publicationid}-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var expect = chakram.expect;
describe('tests for /v2.0/data/publications/{publicationid}', function() {
describe('tests for get', function() {
it('should respond 200 for "A list of publications."', function() {
var response = request('get', 'http://localhost:3001/v2.0/data/publications/1784', {
var response = request('get', 'http://localhost:3001/v2.0/data/publications/500', {
'time': true
});

Expand Down
Loading
Loading