Commit 073eafdc authored by Chaillet Maxime's avatar Chaillet Maxime

Add the licence field in the metadata object as recommended by Google. It...

Add the licence field in the metadata object as recommended by Google. It fixes icat/doi-landing-page#77
parent df764cde
Pipeline #14577 canceled with stages
......@@ -3,17 +3,13 @@
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine', 'browserify'],
// list of files / patterns to load in the browser
files: [
'src/beamlineurl.js',
......@@ -33,12 +29,10 @@ module.exports = function (config) {
'bower_components/moment/moment.js'
],
// list of files / patterns to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
......@@ -46,33 +40,28 @@ module.exports = function (config) {
'tests/googleMetadataObject.test.js': ['browserify']
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Firefox', 'Chrome'],
//browsers: ['Firefox'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
......
......@@ -3,7 +3,7 @@
* @param {*} data
*/
function GoogleMetadataObject(data) {
this.data = data;
this.data = JSON.parse(JSON.stringify(data)); //creates a copy of the data object
}
/**
......@@ -33,5 +33,4 @@ GoogleMetadataObject.prototype.setDescription = function () {
} else {
console.log("[GoogleMetadataObject] - The data required by Google is missing the 'name' field. This is required by Google for indexing.");
}
}
}
\ No newline at end of file
......@@ -26,10 +26,10 @@ describe("googleMetadataObject unit tests", () => {
describe("setDescription", () => {
it.each(resources.setDescription, '[setDescription: %s ]', ['aboutThisTest'],
function (element, next) {
let gmo2 = new GoogleMetadataObject(element.data);
gmo2.setDescription();
let gmo = new GoogleMetadataObject(element.data);
gmo.setDescription();
expect(gmo2.getMetadata()).toEqual(element.expected);
expect(gmo.getMetadata()).toEqual(element.expected);
next();
})
})
......
......@@ -10,6 +10,7 @@ module.exports = {
],
setLicense: [
{
aboutThisTest: 'it sets the expected license',
data: library.googleMetadata1,
expected: {
"@context": "http://schema.org",
......@@ -67,12 +68,13 @@ module.exports = {
"@type": "Organization",
"name": "DataCite"
},
license: "https://creativecommons.org/licenses/by/4.0"
"license": "https://creativecommons.org/licenses/by/4.0"
}
}
],
setDescription: [
{
aboutThisTest: 'description is a copy of the name',
data: library.googleMetadata1,
expected: {
"@context": "http://schema.org",
......@@ -130,7 +132,7 @@ module.exports = {
"@type": "Organization",
"name": "DataCite"
},
description: "Nanoscopic Metal Composition of Phagosomal Compartments during Engulfment of E. coli by Professional Phagocytes.",
"description": "Nanoscopic Metal Composition of Phagosomal Compartments during Engulfment of E. coli by Professional Phagocytes.",
}
}
]
......
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