Skip to content
Snippets Groups Projects
Commit 3139d4af authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

test(mts): skip test script ftm

parent bbcd2027
No related branches found
No related tags found
1 merge request!14Sprint #15
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"src" "src"
], ],
"scripts": { "scripts": {
"test": "jest", "test": "echo \"Error: no test specified\" && exit 1",
"convert": "xml-js xml.xml --spaces 4 --out test.json" "convert": "xml-js xml.xml --spaces 4 --out test.json"
}, },
"repository": { "repository": {
......
...@@ -3,7 +3,7 @@ const convert = require('xml-js') ...@@ -3,7 +3,7 @@ const convert = require('xml-js')
const { set } = require('lodash') const { set } = require('lodash')
const logger = require('@pubsweet/logger') const logger = require('@pubsweet/logger')
const jsonTemplate = require('./mts-json-template') const mts = require('./mts-json-template')
const options = { const options = {
compact: true, compact: true,
...@@ -107,12 +107,6 @@ const fragment = { ...@@ -107,12 +107,6 @@ const fragment = {
const setMetadata = (metadata, jsonTemplate) => { const setMetadata = (metadata, jsonTemplate) => {
const titleGroup = { const titleGroup = {
'article-title': convert.xml2js(metadata.title, options), 'article-title': convert.xml2js(metadata.title, options),
'alt-title': {
_attributes: {
'alt-title-type': 'running-head',
},
_text: "let's hope this works",
},
} }
set(jsonTemplate, 'article.front.article-meta.title-group', titleGroup) set(jsonTemplate, 'article.front.article-meta.title-group', titleGroup)
set( set(
...@@ -184,7 +178,7 @@ const setContributors = (authors, jsonTemplate) => { ...@@ -184,7 +178,7 @@ const setContributors = (authors, jsonTemplate) => {
_text: a.lastName, _text: a.lastName,
}, },
prefix: { prefix: {
_text: a.title || 'Dr', _text: a.title || 'Dr.',
}, },
}, },
email: { email: {
...@@ -212,7 +206,7 @@ const setContributors = (authors, jsonTemplate) => { ...@@ -212,7 +206,7 @@ const setContributors = (authors, jsonTemplate) => {
return jsonTemplate return jsonTemplate
} }
const composeJson = (json = {}) => { const composeJson = (json = {}, jsonTemplate) => {
const { const {
authors = [], authors = [],
files = [], files = [],
...@@ -229,7 +223,8 @@ const composeJson = (json = {}) => { ...@@ -229,7 +223,8 @@ const composeJson = (json = {}) => {
} }
} }
createXMLFile(composeJson(fragment)) const mtsTemplate = mts.getJsonTemplate()
createXMLFile(composeJson(fragment, mtsTemplate))
module.exports = { module.exports = {
createXMLFile, createXMLFile,
......
module.exports = { const defaultConfig = {
doctype: 'article SYSTEM "JATS-archivearticle1-mathml3.dtd"',
dtdVersion: '1.1d1',
articleType: 'Research Article',
journalIdPublisher: 'research',
email: 'faraday@hindawi.com',
journalTitle: 'Bioinorganic Chemistry and Applications',
issn: '2474-7394',
}
const getJsonTemplate = (config = defaultConfig) => ({
_declaration: { _declaration: {
_attributes: { _attributes: {
version: '1.0', version: '1.0',
encoding: 'utf-8', encoding: 'utf-8',
}, },
}, },
_doctype: 'article SYSTEM "JATS-archivearticle1-mathml3.dtd"', _doctype: config.doctype,
article: { article: {
_attributes: { _attributes: {
'dtd-version': '1.1d1', 'dtd-version': config.dtdVersion,
'article-type': 'Research Article', 'article-type': config.articleType,
}, },
front: { front: {
'journal-meta': { 'journal-meta': {
...@@ -18,18 +28,18 @@ module.exports = { ...@@ -18,18 +28,18 @@ module.exports = {
_attributes: { _attributes: {
'journal-id-type': 'publisher', 'journal-id-type': 'publisher',
}, },
_text: 'research', _text: config.journalIdPublisher,
}, },
{ {
_attributes: { _attributes: {
'journal-id-type': 'email', 'journal-id-type': 'email',
}, },
_text: 'faraday@hindawi.com', _text: config.email,
}, },
], ],
'journal-title-group': { 'journal-title-group': {
'journal-title': { 'journal-title': {
_text: 'Bioinorganic Chemistry and Applications', _text: config.journalTitle,
}, },
}, },
issn: [ issn: [
...@@ -37,7 +47,7 @@ module.exports = { ...@@ -37,7 +47,7 @@ module.exports = {
_attributes: { _attributes: {
'pub-type': 'ppub', 'pub-type': 'ppub',
}, },
_text: '2474-7394', _text: config.issn,
}, },
{ {
_attributes: { _attributes: {
...@@ -166,4 +176,8 @@ module.exports = { ...@@ -166,4 +176,8 @@ module.exports = {
], ],
}, },
}, },
})
module.exports = {
getJsonTemplate,
} }
...@@ -7,4 +7,13 @@ export default { ...@@ -7,4 +7,13 @@ export default {
logo: '/assets/hindawi-logo.png', logo: '/assets/hindawi-logo.png',
nameText: 'Faraday Journal', nameText: 'Faraday Journal',
email: 'faraday@hindawi.com', email: 'faraday@hindawi.com',
mts: {
doctype: 'article SYSTEM "JATS-archivearticle1-mathml3.dtd"',
dtdVersion: '1.1d1',
articleType: 'Research Article',
journalIdPublisher: 'research',
email: 'faraday@hindawi.com',
journalTitle: 'Bioinorganic Chemistry and Applications',
issn: '2474-7394',
},
} }
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