From 43936a668ae0aeb65f08654bf782afa1d43d2704 Mon Sep 17 00:00:00 2001 From: Vera Kahn Date: Thu, 11 Apr 2024 11:58:25 -0400 Subject: [PATCH] remove schomburg phys requestability logic --- lib/requestability_resolver.js | 6 +- lib/util.js | 25 - test/fixtures/schomburg.js | 1104 -------------------------- test/requestability_resolver.test.js | 24 - test/util.test.js | 23 - 5 files changed, 1 insertion(+), 1181 deletions(-) delete mode 100644 test/fixtures/schomburg.js diff --git a/lib/requestability_resolver.js b/lib/requestability_resolver.js index 9574a314..52b4d816 100644 --- a/lib/requestability_resolver.js +++ b/lib/requestability_resolver.js @@ -1,6 +1,6 @@ const DeliveryLocationsResolver = require('./delivery-locations-resolver') const { isItemNyplOwned } = require('./ownership_determination') -const { isInRecap, isInSchomburg, getSchomburgDeliveryInfo } = require('./util') +const { isInRecap } = require('./util') const logger = require('./logger') class RequestabilityResolver { static fixItemRequestability (elasticSearchResponse) { @@ -26,10 +26,6 @@ class RequestabilityResolver { physRequestableCriteria = `${deliveryInfo.deliveryLocation && deliveryInfo.deliveryLocation.length || 0} delivery locations.` } - if (isInSchomburg(item)) { - deliveryInfo = getSchomburgDeliveryInfo(item, deliveryInfo) - physRequestableCriteria = deliveryInfo.criteria - } item.eddRequestable = !!deliveryInfo.eddRequestable item.physRequestable = !!(deliveryInfo.deliveryLocation && deliveryInfo.deliveryLocation.length) diff --git a/lib/util.js b/lib/util.js index 542fed4c..b9707ab8 100644 --- a/lib/util.js +++ b/lib/util.js @@ -486,28 +486,3 @@ exports.isInRecap = (item) => { exports.itemHasRecapHoldingLocation(item) || !isItemNyplOwned(item) } - -exports.isInSchomburg = (item) => { - const holdingLocation = exports.deepValue(item, 'holdingLocation[0].id') - if (holdingLocation) { - return holdingLocation.startsWith('loc:sc') - } -} - -exports.getSchomburgDeliveryInfo = (item, deliveryInfo) => { - const itemType = exports.deepValue(item, 'catalogItemType[0].id') - if (itemType) { - const itemNumber = itemType.split(':')[1] - const holdingLocation = exports.deepValue(item, 'holdingLocation[0].id') - const case1 = holdingLocation === 'loc:scff3' && itemNumber === '26' - const case2 = holdingLocation === 'loc:scff2' && itemNumber === '6' - let criteria - if (case1) criteria = 'scff3 microfiche' - else if (case2) criteria = 'scff2 microfilm' - else { - deliveryInfo.deliveryLocation = [] - criteria = 'Non requestable schomburg catalog item type ' + itemNumber - } - return Object.assign({}, deliveryInfo, { criteria }) - } -} diff --git a/test/fixtures/schomburg.js b/test/fixtures/schomburg.js deleted file mode 100644 index d80870b5..00000000 --- a/test/fixtures/schomburg.js +++ /dev/null @@ -1,1104 +0,0 @@ -module.exports = { - scff3Microfiche: { - 'took': 817, - 'timed_out': false, - '_shards': { - 'total': 3, - 'successful': 3, - 'failed': 0 - }, - 'hits': { - 'total': 18434492, - 'max_score': null, - 'hits': [{ - '_index': 'resources-2020-05-08', - '_type': 'resource', - '_id': 'b10769327', - '_version': 6, - 'found': true, - '_source': { - 'extent': [ - 'v, 107 leaves.' - ], - 'note': [ - { - 'noteType': 'Thesis', - 'label': 'Thesis (Ph. D.)--University of California, Berkeley, June 1977.', - 'type': 'bf:Note' - }, - { - 'noteType': 'Bibliography', - 'label': 'Bibliography: leaves 100-107.', - 'type': 'bf:Note' - }, - { - 'noteType': 'Reproduction', - 'label': 'Microfiche.', - 'type': 'bf:Note' - } - ], - 'nyplSource': 'sierra-nypl', - 'subjectLiteral_exploded': [ - 'African American children', - 'African American children -- Language', - 'African Americans', - 'African Americans -- Study and teaching', - 'Black English', - 'Reading (Elementary)' - ], - 'language': [ - { - 'id': 'lang:eng', - 'label': 'English' - } - ], - 'createdYear': [ - 1977 - ], - 'type': [ - 'nypl:Item' - ], - 'title': [ - 'The effect of Black examiners, who speak Black dialect or standard English, on the test performance of Black second and third grade students administered the survey of primary reading development [microform] / ' - ], - 'shelfMark': [ - 'Sc Micro F-10210' - ], - 'creatorLiteral': [ - 'Fisch, Elaine.' - ], - 'createdString': [ - '1977' - ], - 'materialType_packed': [ - 'resourcetypes:txt||Text' - ], - 'language_packed': [ - 'lang:eng||English' - ], - 'dateStartYear': [ - 1977 - ], - 'identifierV2': [ - { - 'type': 'bf:ShelfMark', - 'value': 'Sc Micro F-10210' - }, - { - 'type': 'nypl:Bnumber', - 'value': '10769327' - }, - { - 'type': 'bf:Identifier', - 'value': '(WaOLN)nyp0776221' - } - ], - 'creator_sort': [ - 'fisch, elaine.' - ], - 'carrierType_packed': [ - 'carriertypes:nc||volume' - ], - 'issuance_packed': [ - 'urn:biblevel:m||monograph/item' - ], - 'holdings': [], - 'updatedAt': 1619446503123, - 'mediaType_packed': [ - 'mediatypes:n||unmediated' - ], - 'publicationStatement': [ - '1977.' - ], - 'identifier': [ - 'urn:bnum:10769327', - 'urn:undefined:(WaOLN)nyp0776221' - ], - 'materialType': [ - { - 'id': 'resourcetypes:txt', - 'label': 'Text' - } - ], - 'carrierType': [ - { - 'id': 'carriertypes:nc', - 'label': 'volume' - } - ], - 'title_sort': [ - 'the effect of black examiners, who speak black dialect or standard english, on t' - ], - 'dateString': [ - '1977' - ], - 'mediaType': [ - { - 'id': 'mediatypes:n', - 'label': 'unmediated' - } - ], - 'subjectLiteral': [ - 'African American children -- Language.', - 'African Americans -- Study and teaching.', - 'Black English.', - 'Reading (Elementary)' - ], - 'titleDisplay': [ - 'The effect of Black examiners, who speak Black dialect or standard English, on the test performance of Black second and third grade students administered the survey of primary reading development [microform] / by Elaine Fisch.' - ], - 'uri': 'b10769327', - 'numItems': [ - 1 - ], - 'numAvailable': [ - 1 - ], - 'uris': [ - 'b10769327', - 'b10769327-i13909591' - ], - 'issuance': [ - { - 'id': 'urn:biblevel:m', - 'label': 'monograph/item' - } - ], - 'items': [ - { - 'owner': [ - { - 'id': 'orgs:1114', - 'label': 'Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' - } - ], - 'accessMessage_packed': [ - 'accessMessage:1||Use in library' - ], - 'identifier': [ - 'urn:barcode:33433058833009' - ], - 'shelfMark_sort': 'aSc Micro F-10210 no. 000001-2', - 'catalogItemType_packed': [ - 'catalogItemType:26||microfiche' - ], - 'accessMessage': [ - { - 'id': 'accessMessage:1', - 'label': 'Use in library' - } - ], - 'status_packed': [ - 'status:a||Available ' - ], - 'uri': 'i13909591', - 'shelfMark': [ - 'Sc Micro F-10210 no. 1-2' - ], - 'identifierV2': [ - { - 'type': 'bf:ShelfMark', - 'value': 'Sc Micro F-10210 no. 1-2' - }, - { - 'type': 'bf:Barcode', - 'value': '33433058833009' - } - ], - 'holdingLocation_packed': [ - 'loc:scff3||Schomburg Center - Research & Reference - Desk' - ], - 'idBarcode': [ - '33433058833009' - ], - 'owner_packed': [ - 'orgs:1114||Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' - ], - 'requestable': [ - false - ], - 'catalogItemType': [ - { - 'id': 'catalogItemType:26', - 'label': 'microfiche' - } - ], - 'status': [ - { - 'id': 'status:a', - 'label': 'Available ' - } - ], - 'holdingLocation': [ - { - 'id': 'loc:scff3', - 'label': 'Schomburg Center - Research & Reference - Desk' - } - ] - } - ] - } - }] - } - }, - invalidTypeScff3: { - 'took': 817, - 'timed_out': false, - '_shards': { - 'total': 3, - 'successful': 3, - 'failed': 0 - }, - 'hits': { - 'total': 18434492, - 'max_score': null, - 'hits': [ - { - '_index': 'resources-2020-05-08', - '_type': 'resource', - '_id': 'b13643829', - '_version': 3, - 'found': true, - '_source': { - 'extent': [ - '20 p. : ill. ;' - ], - 'note': [ - { - 'noteType': 'Note', - 'label': 'Cover title.', - 'type': 'bf:Note' - }, - { - 'noteType': 'Note', - 'label': 'At head of title: Dark & Lovely.', - 'type': 'bf:Note' - } - ], - 'nyplSource': 'sierra-nypl', - 'subjectLiteral_exploded': [ - 'African American families', - 'Family reunions', - 'Family reunions -- United States', - 'Family reunions -- United States -- Planning', - 'Still family' - ], - 'publisherLiteral': [ - 's.n.,' - ], - 'language': [ - { - 'id': 'lang:eng', - 'label': 'English' - } - ], - 'createdYear': [ - 1994 - ], - 'dateEndString': [ - '1995' - ], - 'type': [ - 'nypl:Item' - ], - 'title': [ - 'Proud heritage guide to planning a successful family reunion' - ], - 'shelfMark': [ - 'Sc D 98-2481' - ], - 'materialType_packed': [ - 'resourcetypes:txt||Text' - ], - 'createdString': [ - '1994' - ], - 'language_packed': [ - 'lang:eng||English' - ], - 'dateStartYear': [ - 1994 - ], - 'identifierV2': [ - { - 'type': 'bf:ShelfMark', - 'value': 'Sc D 98-2481' - }, - { - 'type': 'nypl:Bnumber', - 'value': '13643829' - } - ], - 'carrierType_packed': [ - 'carriertypes:nc||volume' - ], - 'issuance_packed': [ - 'urn:biblevel:m||monograph/item' - ], - 'dateEndYear': [ - 1995 - ], - 'updatedAt': 1524981554942, - 'mediaType_packed': [ - 'mediatypes:n||unmediated' - ], - 'publicationStatement': [ - '[S.l. : s.n., 1994 or 1995]' - ], - 'identifier': [ - 'urn:bnum:13643829' - ], - 'materialType': [ - { - 'id': 'resourcetypes:txt', - 'label': 'Text' - } - ], - 'carrierType': [ - { - 'id': 'carriertypes:nc', - 'label': 'volume' - } - ], - 'dateString': [ - '1994' - ], - 'title_sort': [ - 'proud heritage guide to planning a successful family reunion' - ], - 'mediaType': [ - { - 'id': 'mediatypes:n', - 'label': 'unmediated' - } - ], - 'subjectLiteral': [ - 'African American families.', - 'Family reunions -- United States -- Planning.', - 'Still family.' - ], - 'titleDisplay': [ - 'Proud heritage guide to planning a successful family reunion / compliments of the Still family.' - ], - 'uri': 'b13643829', - 'numItems': [ - 1 - ], - 'numAvailable': [ - 1 - ], - 'uris': [ - 'b13643829', - 'b13643829-i11305566' - ], - 'placeOfPublication': [ - '[S.l. :' - ], - 'issuance': [ - { - 'id': 'urn:biblevel:m', - 'label': 'monograph/item' - } - ], - 'items': [ - { - 'accessMessage_packed': [ - 'accessMessage:1||Use in library' - ], - 'owner': [ - { - 'id': 'orgs:1114', - 'label': 'Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' - } - ], - 'identifier': [ - 'urn:barcode:33433015885043' - ], - 'catalogItemType_packed': [ - 'catalogItemType:2||book non-circ' - ], - 'accessMessage': [ - { - 'id': 'accessMessage:1', - 'label': 'Use in library' - } - ], - 'status_packed': [ - 'status:a||Available ' - ], - 'uri': 'i11305566', - 'shelfMark': [ - 'Sc D 98-2481' - ], - 'identifierV2': [ - { - 'type': 'bf:ShelfMark', - 'value': 'Sc D 98-2481' - }, - { - 'type': 'bf:Barcode', - 'value': '33433015885043' - } - ], - 'holdingLocation_packed': [ - 'loc:scff3||Schomburg Center - Research & Reference - Desk' - ], - 'idBarcode': [ - '33433015885043' - ], - 'owner_packed': [ - 'orgs:1114||Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' - ], - 'requestable': [ - false - ], - 'catalogItemType': [ - { - 'id': 'catalogItemType:2', - 'label': 'book non-circ' - } - ], - 'status': [ - { - 'id': 'status:a', - 'label': 'Available ' - } - ], - 'holdingLocation': [ - { - 'id': 'loc:scff3', - 'label': 'Schomburg Center - Research & Reference - Desk' - } - ] - } - ], - 'dimensions': [ - '22 cm.' - ] - } - }] - } - }, - scff2Microfilm: { - 'took': 817, - 'timed_out': false, - '_shards': { - 'total': 3, - 'successful': 3, - 'failed': 0 - }, - 'hits': { - 'total': 18434492, - 'max_score': null, - 'hits': [{ - '_index': 'resources-2020-05-08', - '_type': 'resource', - '_id': 'b10224367', - '_version': 6, - 'found': true, - '_source': { - 'extent': [ - '223 p.' - ], - 'note': [ - { - 'noteType': 'Reproduction', - 'label': 'Microfilm.', - 'type': 'bf:Note' - } - ], - 'nyplSource': 'sierra-nypl', - 'subjectLiteral_exploded': [ - 'Helper, Hinton Rowan, 1829-1909', - 'Slavery', - 'Slavery -- United States', - 'Slavery -- United States -- Controversial literature', - 'Slavery -- United States -- Controversial literature -- 1860-' - ], - 'publisherLiteral': [ - 'J. T. Lloyd,' - ], - 'language': [ - { - 'id': 'lang:eng', - 'label': 'English' - } - ], - 'createdYear': [ - 1860 - ], - 'type': [ - 'nypl:Item' - ], - 'title': [ - "Helper's Impending crisis dissected[microform]" - ], - 'shelfMark': [ - 'Sc Micro R-864 [pt. G]' - ], - 'creatorLiteral': [ - 'Wolfe, Samuel M.' - ], - 'createdString': [ - '1860' - ], - 'materialType_packed': [ - 'resourcetypes:txt||Text' - ], - 'idLccn': [ - '11017853' - ], - 'language_packed': [ - 'lang:eng||English' - ], - 'dateStartYear': [ - 1860 - ], - 'identifierV2': [ - { - 'type': 'bf:ShelfMark', - 'value': 'Sc Micro R-864 [pt. G]' - }, - { - 'type': 'nypl:Bnumber', - 'value': '10224367' - }, - { - 'type': 'bf:Lccn', - 'value': '11017853' - }, - { - 'type': 'bf:Identifier', - 'value': 'NN754080857' - }, - { - 'type': 'bf:Identifier', - 'value': '(WaOLN)nyp0226236' - } - ], - 'creator_sort': [ - 'wolfe, samuel m.' - ], - 'carrierType_packed': [ - 'carriertypes:nc||volume' - ], - 'issuance_packed': [ - 'urn:biblevel:m||monograph/item' - ], - 'holdings': [], - 'updatedAt': 1619445163123, - 'mediaType_packed': [ - 'mediatypes:n||unmediated' - ], - 'publicationStatement': [ - 'Philadelphia: J. T. Lloyd, 1860.' - ], - 'identifier': [ - 'urn:bnum:10224367', - 'urn:lccn:11017853', - 'urn:undefined:NN754080857', - 'urn:undefined:(WaOLN)nyp0226236' - ], - 'materialType': [ - { - 'id': 'resourcetypes:txt', - 'label': 'Text' - } - ], - 'carrierType': [ - { - 'id': 'carriertypes:nc', - 'label': 'volume' - } - ], - 'title_sort': [ - "helper's impending crisis dissected[microform]" - ], - 'dateString': [ - '1860' - ], - 'mediaType': [ - { - 'id': 'mediatypes:n', - 'label': 'unmediated' - } - ], - 'subjectLiteral': [ - 'Helper, Hinton Rowan, 1829-1909.', - 'Slavery -- United States -- Controversial literature -- 1860-' - ], - 'titleDisplay': [ - "Helper's Impending crisis dissected[microform] / by Samuel M.Wolfe, Virginia." - ], - 'uri': 'b10224367', - 'numItems': [ - 2 - ], - 'numAvailable': [ - 2 - ], - 'uris': [ - 'b10224367', - 'b10224367-i24028840', - 'b10224367-i30547944', - 'b10224367-i10053088' - ], - 'placeOfPublication': [ - 'Philadelphia:' - ], - 'issuance': [ - { - 'id': 'urn:biblevel:m', - 'label': 'monograph/item' - } - ], - 'items': [ - { - 'owner': [ - { - 'id': 'orgs:1114', - 'label': 'Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' - } - ], - 'accessMessage_packed': [ - 'accessMessage:1||Use in library' - ], - 'identifier': [ - 'urn:barcode:33433016495024' - ], - 'shelfMark_sort': 'aSc Micro R-000864', - 'catalogItemType_packed': [ - 'catalogItemType:6||microfilm service copy' - ], - 'accessMessage': [ - { - 'id': 'accessMessage:1', - 'label': 'Use in library' - } - ], - 'status_packed': [ - 'status:a||Available ' - ], - 'uri': 'i24028840', - 'shelfMark': [ - 'Sc Micro R-864' - ], - 'identifierV2': [ - { - 'type': 'bf:ShelfMark', - 'value': 'Sc Micro R-864' - }, - { - 'type': 'bf:Barcode', - 'value': '33433016495024' - } - ], - 'holdingLocation_packed': [ - 'loc:scff2||Schomburg Center - Research & Reference' - ], - 'idBarcode': [ - '33433016495024' - ], - 'owner_packed': [ - 'orgs:1114||Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' - ], - 'requestable': [ - false - ], - 'catalogItemType': [ - { - 'id': 'catalogItemType:6', - 'label': 'microfilm service copy' - } - ], - 'status': [ - { - 'id': 'status:a', - 'label': 'Available ' - } - ], - 'holdingLocation': [ - { - 'id': 'loc:scff2', - 'label': 'Schomburg Center - Research & Reference' - } - ] - }, - { - 'owner': [ - { - 'id': 'orgs:1114', - 'label': 'Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' - } - ], - 'accessMessage_packed': [ - 'accessMessage:1||Use in library' - ], - 'shelfMark_sort': 'aSc Micro R-864 [pt. G]', - 'catalogItemType_packed': [ - 'catalogItemType:6||microfilm service copy' - ], - 'accessMessage': [ - { - 'id': 'accessMessage:1', - 'label': 'Use in library' - } - ], - 'status_packed': [ - 'status:a||Available' - ], - 'uri': 'i10053088', - 'shelfMark': [ - 'Sc Micro R-864 [pt. G]' - ], - 'identifierV2': [ - { - 'type': 'bf:ShelfMark', - 'value': 'Sc Micro R-864 [pt. G]' - } - ], - 'holdingLocation_packed': [ - 'loc:scff2||Schomburg Center - Research & Reference' - ], - 'owner_packed': [ - 'orgs:1114||Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' - ], - 'requestable': [ - false - ], - 'catalogItemType': [ - { - 'id': 'catalogItemType:6', - 'label': 'microfilm service copy' - } - ], - 'status': [ - { - 'id': 'status:a', - 'label': 'Available' - } - ], - 'holdingLocation': [ - { - 'id': 'loc:scff2', - 'label': 'Schomburg Center - Research & Reference' - } - ] - } - ] - } - }] - } - }, - invalidTypeScff2: { - 'took': 817, - 'timed_out': false, - '_shards': { - 'total': 3, - 'successful': 3, - 'failed': 0 - }, - 'hits': { - 'total': 18434492, - 'max_score': null, - 'hits': [{ - '_index': 'resources-2020-05-08', - '_type': 'resource', - '_id': 'b10224367', - '_version': 6, - 'found': true, - '_source': { - 'extent': [ - '223 p.' - ], - 'note': [ - { - 'noteType': 'Reproduction', - 'label': 'Microfilm.', - 'type': 'bf:Note' - } - ], - 'nyplSource': 'sierra-nypl', - 'subjectLiteral_exploded': [ - 'Helper, Hinton Rowan, 1829-1909', - 'Slavery', - 'Slavery -- United States', - 'Slavery -- United States -- Controversial literature', - 'Slavery -- United States -- Controversial literature -- 1860-' - ], - 'publisherLiteral': [ - 'J. T. Lloyd,' - ], - 'language': [ - { - 'id': 'lang:eng', - 'label': 'English' - } - ], - 'createdYear': [ - 1860 - ], - 'type': [ - 'nypl:Item' - ], - 'title': [ - "Helper's Impending crisis dissected[microform]" - ], - 'shelfMark': [ - 'Sc Micro R-864 [pt. G]' - ], - 'creatorLiteral': [ - 'Wolfe, Samuel M.' - ], - 'createdString': [ - '1860' - ], - 'materialType_packed': [ - 'resourcetypes:txt||Text' - ], - 'idLccn': [ - '11017853' - ], - 'language_packed': [ - 'lang:eng||English' - ], - 'dateStartYear': [ - 1860 - ], - 'identifierV2': [ - { - 'type': 'bf:ShelfMark', - 'value': 'Sc Micro R-864 [pt. G]' - }, - { - 'type': 'nypl:Bnumber', - 'value': '10224367' - }, - { - 'type': 'bf:Lccn', - 'value': '11017853' - }, - { - 'type': 'bf:Identifier', - 'value': 'NN754080857' - }, - { - 'type': 'bf:Identifier', - 'value': '(WaOLN)nyp0226236' - } - ], - 'creator_sort': [ - 'wolfe, samuel m.' - ], - 'carrierType_packed': [ - 'carriertypes:nc||volume' - ], - 'issuance_packed': [ - 'urn:biblevel:m||monograph/item' - ], - 'holdings': [], - 'updatedAt': 1619445163123, - 'mediaType_packed': [ - 'mediatypes:n||unmediated' - ], - 'publicationStatement': [ - 'Philadelphia: J. T. Lloyd, 1860.' - ], - 'identifier': [ - 'urn:bnum:10224367', - 'urn:lccn:11017853', - 'urn:undefined:NN754080857', - 'urn:undefined:(WaOLN)nyp0226236' - ], - 'materialType': [ - { - 'id': 'resourcetypes:txt', - 'label': 'Text' - } - ], - 'carrierType': [ - { - 'id': 'carriertypes:nc', - 'label': 'volume' - } - ], - 'title_sort': [ - "helper's impending crisis dissected[microform]" - ], - 'dateString': [ - '1860' - ], - 'mediaType': [ - { - 'id': 'mediatypes:n', - 'label': 'unmediated' - } - ], - 'subjectLiteral': [ - 'Helper, Hinton Rowan, 1829-1909.', - 'Slavery -- United States -- Controversial literature -- 1860-' - ], - 'titleDisplay': [ - "Helper's Impending crisis dissected[microform] / by Samuel M.Wolfe, Virginia." - ], - 'uri': 'b10224367', - 'numItems': [ - 2 - ], - 'numAvailable': [ - 2 - ], - 'uris': [ - 'b10224367', - 'b10224367-i24028840', - 'b10224367-i30547944', - 'b10224367-i10053088' - ], - 'placeOfPublication': [ - 'Philadelphia:' - ], - 'issuance': [ - { - 'id': 'urn:biblevel:m', - 'label': 'monograph/item' - } - ], - 'items': [ - { - 'owner': [ - { - 'id': 'orgs:1114', - 'label': 'Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' - } - ], - 'accessMessage_packed': [ - 'accessMessage:1||Use in library' - ], - 'identifier': [ - 'urn:barcode:33433016495024' - ], - 'shelfMark_sort': 'aSc Micro R-000864', - 'catalogItemType_packed': [ - 'catalogItemType:6||microfilm service copy' - ], - 'accessMessage': [ - { - 'id': 'accessMessage:1', - 'label': 'Use in library' - } - ], - 'status_packed': [ - 'status:a||Available ' - ], - 'uri': 'i24028840', - 'shelfMark': [ - 'Sc Micro R-864' - ], - 'identifierV2': [ - { - 'type': 'bf:ShelfMark', - 'value': 'Sc Micro R-864' - }, - { - 'type': 'bf:Barcode', - 'value': '33433016495024' - } - ], - 'holdingLocation_packed': [ - 'loc:scff2||Schomburg Center - Research & Reference' - ], - 'idBarcode': [ - '33433016495024' - ], - 'owner_packed': [ - 'orgs:1114||Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' - ], - 'requestable': [ - false - ], - 'catalogItemType': [ - { - 'id': 'catalogItemType:4', - 'label': 'microfilm service copy' - } - ], - 'status': [ - { - 'id': 'status:a', - 'label': 'Available ' - } - ], - 'holdingLocation': [ - { - 'id': 'loc:scff2', - 'label': 'Schomburg Center - Research & Reference' - } - ] - }, - { - 'owner': [ - { - 'id': 'orgs:1114', - 'label': 'Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' - } - ], - 'accessMessage_packed': [ - 'accessMessage:1||Use in library' - ], - 'shelfMark_sort': 'aSc Micro R-864 [pt. G]', - 'catalogItemType_packed': [ - 'catalogItemType:6||microfilm service copy' - ], - 'accessMessage': [ - { - 'id': 'accessMessage:1', - 'label': 'Use in library' - } - ], - 'status_packed': [ - 'status:a||Available' - ], - 'uri': 'i10053088', - 'shelfMark': [ - 'Sc Micro R-864 [pt. G]' - ], - 'identifierV2': [ - { - 'type': 'bf:ShelfMark', - 'value': 'Sc Micro R-864 [pt. G]' - } - ], - 'holdingLocation_packed': [ - 'loc:scff2||Schomburg Center - Research & Reference' - ], - 'owner_packed': [ - 'orgs:1114||Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' - ], - 'requestable': [ - false - ], - 'catalogItemType': [ - { - 'id': 'catalogItemType:6', - 'label': 'microfilm service copy' - } - ], - 'status': [ - { - 'id': 'status:a', - 'label': 'Available' - } - ], - 'holdingLocation': [ - { - 'id': 'loc:scff2', - 'label': 'Schomburg Center - Research & Reference' - } - ] - } - ] - } - }] - } - } -} diff --git a/test/requestability_resolver.test.js b/test/requestability_resolver.test.js index 1c2a8b72..164a2a45 100644 --- a/test/requestability_resolver.test.js +++ b/test/requestability_resolver.test.js @@ -3,32 +3,8 @@ const elasticSearchResponse = require('./fixtures/elastic_search_response.js') const specRequestableElasticSearchResponse = require('./fixtures/specRequestable-es-response') const eddElasticSearchResponse = require('./fixtures/edd_elastic_search_response') const noBarcodeResponse = require('./fixtures/no_barcode_es_response') -// const { scff3Microfiche, invalidTypeScff3, scff2Microfilm, invalidTypeScff2 } = require('./fixtures/schomburg.js') -const { scff3Microfiche, invalidTypeScff3, invalidTypeScff2 } = require('./fixtures/schomburg.js') describe('RequestabilityResolver', () => { - describe('Schomburg requestability', () => { - it('returns physRequestable true for scff3 microfiche', () => { - const resp = RequestabilityResolver.fixItemRequestability(scff3Microfiche) - const item = resp.hits.hits[0]._source.items[0] - expect(item.physRequestable).to.be.true - }) - it('returns physRequestable false for invalid item type, scff3', () => { - const resp = RequestabilityResolver.fixItemRequestability(invalidTypeScff3) - const item = resp.hits.hits[0]._source.items[0] - expect(item.physRequestable).to.be.false - }) - // it('returns physRequestable true for scff2 microfilm', () => { - // const resp = RequestabilityResolver.fixItemRequestability(scff2Microfilm) - // const item = resp.hits.hits[0]._source.items[0] - // expect(item.physRequestable).to.be.true - // }) - it('returns physRequestable false for invalid item type, scff2', () => { - const resp = RequestabilityResolver.fixItemRequestability(invalidTypeScff2) - const item = resp.hits.hits[0]._source.items[0] - expect(item.physRequestable).to.be.false - }) - }) describe('fixItemRequestability', function () { const NyplResponse = elasticSearchResponse.fakeElasticSearchResponseNyplItem() it('sets physRequestable false for items with no barcodes', () => { diff --git a/test/util.test.js b/test/util.test.js index d10769ae..3f9d3ad1 100644 --- a/test/util.test.js +++ b/test/util.test.js @@ -3,29 +3,6 @@ const { expect } = require('chai') const util = require('../lib/util') describe('Util', function () { - describe('isSchomburg', () => { - it('returns false for non schomburg location', () => { - const item = { - 'holdingLocation': [ - { - 'id': 'loc:mal' - } - ] - } - expect(util.isInSchomburg(item)).to.be.false - }) - it('returns true for schomburg items', () => { - const item = { - 'holdingLocation': [ - { - 'id': 'loc:scff3' - } - ] - } - expect(util.isInSchomburg(item)).to.be.true - }) - }) - describe('backslashes', function () { it('escapes specials', function () { const result = util.backslashes('?', 2)