Page MenuHomePhabricator
Paste P5447

Citoid Test Errors
ActivePublic

Authored by mobrovac on May 15 2017, 3:13 PM.
Tags
Referenced Files
F8087021: Citoid Test Errors
May 15 2017, 3:13 PM
Subscribers
None
$ mocha
express app
server options changed; restarting
✓ get robots.txt
✓ get landing page
✓ should set CORS headers
✓ should set CSP headers
service information
✓ should get the service name
✓ should get the service version
✓ should redirect to the service home page
✓ should get the service info
Swagger spec
✓ get the spec
✓ spec validation
routes
✓ spec from root
✓ retrieve service info
(node:10473) DeprecationWarning: parse() is deprecated, use toJson()
✓ Zotero alive (645ms)
✓ open graph via native scraper (1459ms)
address restrictions
✓ localhost:1970
✓ http://localhost:1970
✓ http://127.0.0.1:1970
Expected:
400
Result:
404
1) non-existing
✓ 10.0.0.5
✓ redir-to-zot-supported (2883ms)
✓ redir-to-zot-unsupported (1759ms)
✓ redir-to-private (542ms)
✓ redir-to-redir-private (1131ms)
✓ redir-to-redir-to-redir-to-private (1864ms)
✓ five-redirect-max-by-default-under (7063ms)
✓ five-redirect-max-by-default-over (3563ms)
✓ acceptable domain, with scheme (1369ms)
✓ acceptable domain, without scheme (597ms)
encoding
✓ javascript in format
Expected:
400
Result:
404
2) javascript in search
✓ javascript in doi (1124ms)
✓ json in search
✓ json in format
✓ spaces in fully qualified url (404ms)
✓ spaces in url missing http:// (378ms)
✓ spaces in url missing http:// and www (397ms)
errors
✓ missing search in query
✓ missing format in query
✓ bad format in query
✓ request for base fields for unsupported type
✓ bad domain (127ms)
✓ resource has http errors (374ms)
✓ faulty zotero results (4853ms)
✓ bad doi (868ms)
✓ bad pmid (2368ms)
✓ bad pmcid (1290ms)
errors caused by changing default settings
disable xisbn
server options changed; restarting
stopping test server
Expected:
400
Result:
404
3) isbn- not implemented, assumes url and gets invalid host
parsing
✓ should scrape meta tag charset content
correctly gets base fields instead of more specific fields
server options changed; restarting
stopping test server
using basefields param
using zotero results
✓ conferencePaper (3551ms)
✓ encyclopediaArticle (2258ms)
using native scraper
✓ webpage (819ms)
using basefields format
using zotero results
✓ conferencePaper (3713ms)
✓ encyclopediaArticle (1232ms)
using native scraper
✓ webpage (578ms)
Exports:
Exporting to bibtex:
✓ bibtex from scraper (527ms)
✓ bibtex from zotero (1575ms)
✓ bibtex from pmid (1749ms)
Exporting to zotero:
✓ doi pointing to conferencePaper (2261ms)
✓ doi with ISSN (6183ms)
Exporting to mwDeprecated no longer functioning :
✓ Uses formerly correct parameter
using native scraper
✓ example domain (416ms)
✓ uses original url (1753ms)
✓ websiteTitle but no publicationTitle (5045ms)
- DOI pointing to resource not in zotero
✓ doi in url with query parameters - uses crossRef (7007ms)
✓ url with pseudo doi (1502ms)
✓ itemType from open graph (2849ms)
✓ dublinCore data but no highWire metadata (2864ms)
✓ PMCID but no PMID
ISBN tests:
xisbn service:
server options changed; restarting
stopping test server
✓ valid ISBN (545ms)
✓ valid ISBN with funky author field (304ms)
✓ valid DVD ISBN - type Image (1433ms)
✓ invalid ISBN (511ms)
worldcat search api:
server options changed; restarting
stopping test server
✓ valid book ISBN - type Text (945ms)
✓ valid DVD ISBN - type Image (472ms)
✓ valid DVD ISBN - invalid Type (468ms)
✓ valid ISBN with funky author field (965ms)
✓ invalid ISBN (504ms)
Languages:
Using zotero results:
✓ invalid language code (2998ms)
Using native scraper:
✓ german twitter (1634ms)
✓ open graph locale converted to language code (1178ms)
✓ non-native to node encoding in response (4097ms)
✓ content-type header present in body but not in response headers (3483ms)
- Language present in html tag
mock Zotero service that cannot export
server options changed; restarting
stopping test server
✓ Get error for bibtex export (657ms)
✓ Success with mediawiki export (506ms)
Zotero service down or disabled:
unreachable
server options changed; restarting
stopping test server
✓ PMID not in doi id converter api (500ms)
✓ PMCID present in doi id converter api (7746ms)
✓ JSTOR page (14649ms)
✓ Article with doi within DublinCore metadata + highwire data (6748ms)
✓ doi spage and epage fields in crossRef coins data (5387ms)
✓ successfully uses highwire press metadata (7669ms)
✓ successfully uses bepress press metadata alone (1320ms)
✓ Article with doi and DublinCore metadata (7786ms)
✓ Get error for bibtex export (591ms)
✓ requires cookie handling (5606ms)
✓ DOI pointing to resource that can't be scraped - uses crossRef (6047ms)
✓ dx.DOI link - uses crossRef (6040ms)
✓ Case sensitive DOI with 5 digit registrant code and unknown genre in crossRef (4403ms)
disabled in conf
server options changed; restarting
stopping test server
✓ PMID not in doi id converter api (687ms)
✓ PMCID present in doi id converter api (5935ms)
✓ JSTOR page with tabs in natively scraped title (3585ms)
✓ Article with doi within DublinCore metadata + highwire data (6041ms)
✓ doi spage and epage fields in crossRef coins data (4522ms)
✓ successfully uses highwire press metadata (4522ms)
✓ successfully uses bepress press metadata alone (634ms)
✓ Article with doi and DublinCore metadata (4550ms)
✓ Get error for bibtex export (271ms)
✓ requires cookie handling (3927ms)
✓ DOI pointing to resource that can't be scraped - uses crossRef (9962ms)
✓ dx.DOI link - uses crossRef (7327ms)
✓ Case sensitive DOI with 5 digit registrant code and unknown genre in crossRef (4176ms)
uses zotero
server options changed; restarting
stopping test server
✓ doi pointing to conferencePaper (2980ms)
✓ zotero gives us html tags in title (1854ms)
✓ fixes en dash in zotero results (23641ms)
✓ removes null issn (1488ms)
- Correctly skips bad authors from Zotero whilst converting to mediawiki format
PMID
✓ not in id converter (2842ms)
✓ returns citation interpreted as both pmid and pmcid (2477ms)
✓ with space (1951ms)
✓ with less than eight digits (1889ms)
✓ has PMCID, DOI, PMID (1323ms)
PMCID
✓ with prefix (1374ms)
✓ with trailing space (1473ms)
✓ with encoded space (2563ms)
✓ which requires PMC prefix to retrieve DOI from id converter (2489ms)
DOI
✓ DOI- has PMCID, PMID, DOI (4587ms)
✓ direct DOI (5028ms)
✓ DOI with space (3273ms)
✓ DOI with redirect (4672ms)
- DOI with User-Agent set
✓ non-dx.DOI link with DOI pointing to resource in zotero with no DOI (1268ms)
✓ DOI pointing to resource in zotero with no DOI (3601ms)
✓ DOI.org link pointing to resource in zotero with no DOI (2642ms)
✓ DOI which requires cookie to properly follow redirect to Zotero; no results from crossRef (8293ms)
uses WMF translator fork
✓ Google books link that cause Zotero to have internal server error (2784ms)
✓ Google books link that lacks native url field (2068ms)
type schema data functions
zotero methods
✓ returns false if no base types exist
✓ gets base types - no creators
✓ gets base types - with creators
creator types methods
✓ gets creator type ids
✓ returns empty list if no create type ids exist
✓ gets primary creator id from type
✓ gets creator name from id
✓ gets primary creator id from name
✓ determines if creatorType valid for type- true
✓ determines if creatorType valid for type- false
item fields methods
✓ determines if id is valid for type- false
✓ determines if id is valid for type- true
✓ determines if creator field is valid for type- true
✓ determines if creator field is valid for type- false
✓ get field id from type and base
✓ get base id from type and field
✓ get item type fields
✓ gets field name from id
✓ gets id from field name
lib/Exporter.js functions:
fixURL function:
✓ discards url with no host
✓ adds protocol to url when missing
addIDSToCitation function:
✓ cleans script and html out of title
stripCitation function :
✓ cleans script and html out of title
fixDate function:
✓ Contains copyright symbol
✓ Contains copyright symbol & whitespace
✓ Contains c symbol
✓ sets year only date to year only date
✓ converts American style date to ISO
✓ Uses year from ambiguous date
✓ Normal date
✓ Normal date with ordinal indicator
✓ Correctly sets normal date with ordinal number
✓ Date on the fence: ISO with - notation
✓ Date on the fence; ISO with + notation
✓ Date on the fence; toString output
✓ Date on the fence; ISO with Z notation
✓ Year first date
✓ Partial ISO date no preceeding 0
✓ Partial ISO date proceeding 0
fixISBN function:
✓ Correctly extracts single ISBN
✓ Correctly extracts ISBN-10
✓ Correctly extracts ISBN-13
✓ Correctly extracts ISBN-10 and ISBN-13
✓ Correctly handles and normalizes hyphenated ISBN
✓ Correctly handles ISBNs with and without hyphens
✓ Correctly handles ISBN-13s that have spaces in them
✓ Correctly handles out comma separated ISBNs
fixISSN function:
✓ Correctly ignores invalid ISSN
✓ Correctly adds valid ISSN
✓ Correctly adds valid ISSN with X
✓ Correctly adds valid ISSN with x
✓ Correctly ignores invalid ISSN without hyphen
✓ Correctly ignores invalid ISSN
fixPages function:
✓ converts hyphen minus to en dash
replaceCreators function
✓ Correctly adds name with firstName and lastName present
✓ Correctly adds names with only lastName or firstName present
✓ Adds names with name field
✓ Doesn't add names with incorrect field name
translate function:
✓ translates bePress metadata from movie file
✓ translates bePress metadata from article file
✓ translates highwirePress metadata from movie file
✓ translates highwirePress metadata from article file (57ms)
✓ translates coins metadata from movie file
✓ translates coins metadata from article file
✓ translates dublinCore metadata from movie file (46ms)
✓ translates dublinCore metadata from article file (41ms)
✓ translates general metadata from movie file
✓ translates general metadata from article file
✓ translates openGraph metadata from movie file
✓ translates openGraph metadata from article file
addItemType function:
✓ sets videoRecording itemType
✓ sets article itemType
✓ sets itemType webpage if no relevant metadata available
coins unit
✓ Correctly adds pages from spage and epage
✓ Correctly fixes en dash in pages fields
✓ Correctly adds date
exports.other.addCreators function
✓ Doesn't add empty creators field
✓ Doesn't add creators field if missing itemType
✓ Doesn't add duplicate author names
✓ Doesn't add duplicate author names with nbsp present
✓ Correctly adds name with missing firstname
✓ Correctly adds name with missing lastname
✓ Correctly uses auinit1 and auinitm
✓ Correctly uses auinit1 and auinitm
✓ Correctly adds corporation names
✓ Correctly adds 3 word names
dublinCore translator unit
✓ Creator translate function adds lists of strings
✓ Correctly adds an author string with one word
✓ Correctly adds an author string with two words
✓ Correctly adds an author string with three words
general translator unit
✓ Author function adds lists of strings
✓ Correctly adds an author string with one word
✓ Correctly adds an author string with two words
✓ Correctly adds an author string with three words
✓ Does something redonk with Harry Potter author field from worldcat
translator utilities:
makeTranslator function:
✓ strips leading and trailing whitespace
✓ correctly adds date with fixDate validate function
✓ correctly uses fixLang validate function
makePagesTranslator function:
✓ Uses spage and epage
✓ Uses optional pages arg and converts - to en dash
makeListTranslator function:
✓ Correctly adds one isbn
✓ Correctly uses isbn validate function
✓ Correctly uses issn validate function
✓ Correctly adds two issn and one eissn
✓ Correctly adds two isbn
xISBN translator unit tests:
returnItemType:
✓ Returns book when AA is in list
✓ Returns audioRecording when AA is 2nd in list
✓ Returns book when form is missing
addCreatorTranslator:
✓ Returns book when AA is in list
✓ Correctly adds single author
✓ Correctly adds two authors
✓ Correctly adds 2 authors including illustrator
✓ Correctly adds 3 creators including translator
✓ Rather badly adds 3 creators with trailing titles
✓ Rather badly adds 1 creators with many titles
✓ Quite badly adds editors
✓ Correctly adds 1 creator and discards arbitrary creator
✓ Correctly adds 1 creator and discards arbitrary creator with multiple adjectives
✓ Correctly adds name with missing firstname
✓ Correctly adds different creator type other than author
jshint
✓ should pass for working directory (629ms)
251 passing (5m)
4 pending
3 failing
1) address restrictions non-existing:
AssertionError: Expected status to be 400, but was 404
+ expected - actual
-404
+400
at deepEqual (test/utils/assert.js:52:20)
at Object.status (test/utils/assert.js:12:5)
at Request.<anonymous> (test/features/errors/address.js:47:20)
at Request.tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:689:18)
at Async._drainQueue (node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (node_modules/bluebird/js/release/async.js:17:14)
2) encoding javascript in search:
AssertionError: Expected status to be 400, but was 404
+ expected - actual
-404
+400
at deepEqual (test/utils/assert.js:52:20)
at Object.status (test/utils/assert.js:12:5)
at Request.<anonymous> (test/features/errors/encoding.js:31:20)
at Request.tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:689:18)
at Async._drainQueue (node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (node_modules/bluebird/js/release/async.js:17:14)
3) errors caused by changing default settings disable xisbn isbn- not implemented, assumes url and gets invalid host:
AssertionError: Expected status to be 400, but was 404
+ expected - actual
-404
+400
at deepEqual (test/utils/assert.js:52:20)
at Object.status (test/utils/assert.js:12:5)
at Request.<anonymous> (test/features/errors/settings.js:22:24)
at Request.tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:689:18)
at Async._drainQueue (node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (node_modules/bluebird/js/release/async.js:17:14)