Skip to content

Commit

Permalink
[test:doi] Make DOI test cases less dependent on specific API results
Browse files Browse the repository at this point in the history
See #50
  • Loading branch information
larsgw committed Jul 22, 2017
1 parent 7ad4916 commit 3e13e6f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions test/input.citation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ const wikidataTestCaseOptions = {
link: true
}

const doiTestCaseOptions = {
const doiLinkTestCaseOptions = {
link: true
}

const doiTestCaseOptions = {
link: true,
callback: ({title}) => title
}

module.exports = {
async: function () {
beforeEach(start => start())
Expand Down Expand Up @@ -100,17 +105,17 @@ module.exports = {
})

describe('DOI ID', testCaseGenerator(
test.input.doi.id, 'string/doi', test.output.doi.api[0], doiTestCaseOptions))
test.input.doi.id, 'string/doi', test.output.doi.api[0], doiLinkTestCaseOptions))

describe('DOI URL', testCaseGenerator(
test.input.doi.url, 'api/doi', test.output.doi.simple, doiTestCaseOptions))
test.input.doi.url, 'api/doi', test.output.doi.simple.title, doiTestCaseOptions))

describe('DOI ID list', function () {
describe('separated by spaces', testCaseGenerator(
test.input.doi.list.space, 'list/doi', test.output.doi.api[1], doiTestCaseOptions))
test.input.doi.list.space, 'list/doi', test.output.doi.api[1], doiLinkTestCaseOptions))

describe('separated by newlines', testCaseGenerator(
test.input.doi.list.newline, 'list/doi', test.output.doi.api[1], doiTestCaseOptions))
test.input.doi.list.newline, 'list/doi', test.output.doi.api[1], doiLinkTestCaseOptions))
})

describe('BibTeX string', function () {
Expand Down

0 comments on commit 3e13e6f

Please sign in to comment.