Commit df764cde authored by Maxime Chaillet's avatar Maxime Chaillet

work in progress

parent 90d0623e
......@@ -24,12 +24,13 @@ module.exports = function (config) {
'src/experimentalreportcontroller.js',
'src/event.js',
'src/jsonextractor.js',
'src/googleMetadataObject.js',
'tests/jsonExtractor.test.js',
'tests/doiController.test.js',
'tests/doiData.test.js',
'tests/googleMetadataObject.test.js',
'bower_components/lodash/lodash.js',
'bower_components/moment/moment.js'
],
......@@ -41,7 +42,8 @@ module.exports = function (config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'tests/jsonExtractor.test.js': ['browserify']
'tests/jsonExtractor.test.js': ['browserify'],
'tests/googleMetadataObject.test.js': ['browserify']
},
......
require('it-each')({ testPerIteration: true });
let resources = require('./resources/googleMetadataObject.resource');
describe("googleMetadataObject unit tests", () => {
describe("initialization", () => {
it.each(resources.initialization, '[initialization: %s ]', ['aboutThisTest'],
function (element, next) {
let gmo = new GoogleMetadataObject(element.data);
expect(gmo.getMetadata()).toEqual(element.expected);
next();
})
})
describe("setLicense", () => {
it.each(resources.setLicense, '[setLicense: %s ]', ['aboutThisTest'],
function (element, next) {
let gmo = new GoogleMetadataObject(element.data);
gmo.setLicense();
expect(gmo.getMetadata()).toEqual(element.expected);
next();
})
})
describe("setDescription", () => {
it.each(resources.setDescription, '[setDescription: %s ]', ['aboutThisTest'],
function (element, next) {
let gmo2 = new GoogleMetadataObject(element.data);
gmo2.setDescription();
expect(gmo2.getMetadata()).toEqual(element.expected);
next();
})
})
})
\ No newline at end of file
module.exports = {
googleMetadata1: {
"@context": "http://schema.org",
"@type": "Dataset",
"@id": "https://doi.org/10.15151/esrf-es-47877949",
"identifier": {
"@type": "PropertyValue",
"propertyID": "DOI",
"value": "https://doi.org/10.15151/esrf-es-47877949"
},
"url": "https://doi.esrf.fr/10.15151/ESRF-ES-47877949",
"additionalType": "Experiment Session",
"name": "Nanoscopic Metal Composition of Phagosomal Compartments during Engulfment of E. coli by Professional Phagocytes.",
"author": [
{
"name": "Björn DE SAMBER",
"givenName": "Björn DE",
"familyName": "SAMBER",
"@type": "Person"
},
{
"name": "Constantin URBAN",
"givenName": "Constantin",
"familyName": "URBAN",
"@type": "Person"
},
{
"name": "Bart VEKEMANS",
"givenName": "Bart",
"familyName": "VEKEMANS",
"@type": "Person"
},
{
"name": "Gerald FALKENBERG",
"givenName": "Gerald",
"familyName": "FALKENBERG",
"@type": "Person"
},
{
"name": "Ella DE PAUW",
"givenName": "Ella DE",
"familyName": "PAUW",
"@type": "Person"
}
],
"keywords": "Life Sciences, LS-2550, id16a",
"inLanguage": "eng",
"datePublished": "2020",
"schemaVersion": "http://datacite.org/schema/kernel-3",
"publisher": {
"@type": "Organization",
"name": "European Synchrotron Radiation Facility"
},
"provider": {
"@type": "Organization",
"name": "DataCite"
}
}
}
\ No newline at end of file
let library = require('./googleMetadataLibrary.resource');
module.exports = {
initialization: [
{
aboutThisTest: 'initialization',
data: library.googleMetadata1,
expected: library.googleMetadata1
}
],
setLicense: [
{
data: library.googleMetadata1,
expected: {
"@context": "http://schema.org",
"@type": "Dataset",
"@id": "https://doi.org/10.15151/esrf-es-47877949",
"identifier": {
"@type": "PropertyValue",
"propertyID": "DOI",
"value": "https://doi.org/10.15151/esrf-es-47877949"
},
"url": "https://doi.esrf.fr/10.15151/ESRF-ES-47877949",
"additionalType": "Experiment Session",
"name": "Nanoscopic Metal Composition of Phagosomal Compartments during Engulfment of E. coli by Professional Phagocytes.",
"author": [
{
"name": "Björn DE SAMBER",
"givenName": "Björn DE",
"familyName": "SAMBER",
"@type": "Person"
},
{
"name": "Constantin URBAN",
"givenName": "Constantin",
"familyName": "URBAN",
"@type": "Person"
},
{
"name": "Bart VEKEMANS",
"givenName": "Bart",
"familyName": "VEKEMANS",
"@type": "Person"
},
{
"name": "Gerald FALKENBERG",
"givenName": "Gerald",
"familyName": "FALKENBERG",
"@type": "Person"
},
{
"name": "Ella DE PAUW",
"givenName": "Ella DE",
"familyName": "PAUW",
"@type": "Person"
}
],
"keywords": "Life Sciences, LS-2550, id16a",
"inLanguage": "eng",
"datePublished": "2020",
"schemaVersion": "http://datacite.org/schema/kernel-3",
"publisher": {
"@type": "Organization",
"name": "European Synchrotron Radiation Facility"
},
"provider": {
"@type": "Organization",
"name": "DataCite"
},
license: "https://creativecommons.org/licenses/by/4.0"
}
}
],
setDescription: [
{
data: library.googleMetadata1,
expected: {
"@context": "http://schema.org",
"@type": "Dataset",
"@id": "https://doi.org/10.15151/esrf-es-47877949",
"identifier": {
"@type": "PropertyValue",
"propertyID": "DOI",
"value": "https://doi.org/10.15151/esrf-es-47877949"
},
"url": "https://doi.esrf.fr/10.15151/ESRF-ES-47877949",
"additionalType": "Experiment Session",
"name": "Nanoscopic Metal Composition of Phagosomal Compartments during Engulfment of E. coli by Professional Phagocytes.",
"author": [
{
"name": "Björn DE SAMBER",
"givenName": "Björn DE",
"familyName": "SAMBER",
"@type": "Person"
},
{
"name": "Constantin URBAN",
"givenName": "Constantin",
"familyName": "URBAN",
"@type": "Person"
},
{
"name": "Bart VEKEMANS",
"givenName": "Bart",
"familyName": "VEKEMANS",
"@type": "Person"
},
{
"name": "Gerald FALKENBERG",
"givenName": "Gerald",
"familyName": "FALKENBERG",
"@type": "Person"
},
{
"name": "Ella DE PAUW",
"givenName": "Ella DE",
"familyName": "PAUW",
"@type": "Person"
}
],
"keywords": "Life Sciences, LS-2550, id16a",
"inLanguage": "eng",
"datePublished": "2020",
"schemaVersion": "http://datacite.org/schema/kernel-3",
"publisher": {
"@type": "Organization",
"name": "European Synchrotron Radiation Facility"
},
"provider": {
"@type": "Organization",
"name": "DataCite"
},
description: "Nanoscopic Metal Composition of Phagosomal Compartments during Engulfment of E. coli by Professional Phagocytes.",
}
}
]
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment