Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b6846d4
Merge pull request #580 from NYPL/HOTFIX/remove-schomburg-button
danamansana Oct 31, 2025
e24bdba
Merge pull request #586 from NYPL/qa
danamansana Nov 10, 2025
daa8dbb
Merge pull request #592 from NYPL/qa
danamansana Nov 19, 2025
008c5ab
Merge pull request #594 from NYPL/qa
nonword Nov 21, 2025
1f66eea
Merge pull request #604 from NYPL/qa
danamansana Dec 16, 2025
32ebc2f
Merge pull request #616 from NYPL/qa
charmingduchess Jan 8, 2026
d26f54c
wip
charmingduchess Jan 14, 2026
f4defb6
fix delivery location type biz
charmingduchess Jan 14, 2026
4f4e0e3
rm console.log
charmingduchess Jan 14, 2026
ec1ea45
rm console log
charmingduchess Jan 14, 2026
6404e6a
Merge pull request #619 from NYPL/noref-log-debug-schoalr-rooms
charmingduchess Jan 14, 2026
f917024
Merge pull request #624 from NYPL/qa
7emansell Jan 29, 2026
7a34480
update resources index
charmingduchess Feb 12, 2026
1474814
update index
charmingduchess Feb 13, 2026
97ff97d
Merge pull request #644 from NYPL/update-resources-index-
charmingduchess Feb 13, 2026
5af3cdf
Merge pull request #653 from NYPL/qa
7emansell Mar 2, 2026
b28805c
Merge branch 'main' into production
nonword Mar 9, 2026
b6dcd86
the tests
charmingduchess Mar 16, 2026
3aa92cd
add int test file
charmingduchess Mar 16, 2026
57fef73
Merge branch 'production' into SCC-5164/delivery-integration-test
charmingduchess Mar 16, 2026
b62d846
rm commented code
charmingduchess Mar 16, 2026
4c9e284
Merge branch 'main' into SCC-5164/delivery-integration-test
charmingduchess Mar 17, 2026
8f07bfc
test
charmingduchess Mar 18, 2026
bf3c9ff
Merge pull request #683 from NYPL/SCC-5164/delivery-integration-test-…
charmingduchess Mar 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: integration-test

on:
pull_request:
branches:
- production

jobs:
integration-test:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole
aws-region: us-east-1
- uses: actions/checkout@v3
- name: Set Node version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: npm install
run: npm i
- name: Run integration tests
env:
ENV: 'qa'
run: node test/integration/delivery-locations-by-barcode.test.js
4 changes: 2 additions & 2 deletions config/production.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ENCRYPTED_ELASTICSEARCH_URI=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAJYwgZMGCSqGSIb3DQEHBqCBhTCBggIBADB9BgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDFWw8ECX9Pz81z0kvAIBEIBQGec9PCpwuvEgLH6imhqP6tx1fj8Vlf2ZipnUy06jzmpE262Qvk9LPAq7sIYPVkTCZctwilwcU9oC6yxasVoUlK87la77v03CeZsPIDwciFY=
ENCRYPTED_RESOURCES_INDEX=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAHcwdQYJKoZIhvcNAQcGoGgwZgIBADBhBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDLHxxMobbmmkVc76dQIBEIA0aZV7enzAKvaDMt7lJik1Ps8J6wikj4dJTL6YzjIlpRh8Dsl7tYgpEgsTNVqA7JRhErUT9w==
ENCRYPTED_RESOURCES_INDEX=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAHcwdQYJKoZIhvcNAQcGoGgwZgIBADBhBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDGOwQk67wE9nnptNhgIBEIA0ol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FxfXvIjk/z6Qs81KBAVELhby2iD5LawQyDrR9tjhuMbotS6QnydwwMR/p8+qJXHI=

NYPL_CORE_VERSION=v2.35
NYPL_CORE_VERSION=v2.37

LOG_LEVEL=info
FEATURES=on-site-edd
Expand Down
2 changes: 1 addition & 1 deletion config/qa.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NYPL_OAUTH_URL=https://isso.nypl.org/
ENCRYPTED_NYPL_OAUTH_ID=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDMLKVUQA58B6vprNcAIBEIAoaz0lI9EL2M9NyTuEwT8JDmPBt6aXfMiFs027DEuwsCN0wS0qWeFL1g==
ENCRYPTED_NYPL_OAUTH_SECRET=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAIcwgYQGCSqGSIb3DQEHBqB3MHUCAQAwcAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAyWz91LOP2YP5fg0q0CARCAQ9inO9SV1M8R0Pkkx84r7UdwlU1FxfXvIjk/z6Qs81KBAVELhby2iD5LawQyDrR9tjhuMbotS6QnydwwMR/p8+qJXHI=

NYPL_CORE_VERSION=v2.35
NYPL_CORE_VERSION=v2.37

LOG_LEVEL=debug
FEATURES=on-site-edd
Expand Down
1 change: 0 additions & 1 deletion lib/available_delivery_location_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class AvailableDeliveryLocationTypes {
if (!patronID) return null

const patronType = await this._getPatronTypeOf(patronID)

if (this._isUnfamiliarPatronType(patronType)) {
return null
}
Expand Down
1 change: 0 additions & 1 deletion lib/models/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ Item.withDeliveryLocationsByBarcode = async function (item, scholarRoom) {
const model = new Item(item)
item.eddRequestable = !!model.eddRequestable
const filteredDeliveryLocationsWithScholarRoom = locationUtils.filterLocations(model.deliveryLocation, scholarRoom)

item.deliveryLocation = locationUtils.formatLocations(filteredDeliveryLocationsWithScholarRoom)
return item
}
Expand Down
13 changes: 1 addition & 12 deletions lib/models/Location.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,7 @@ class Location {
case 'm2-customer-code':
return this.deliveryLocationsByM2CustomerCode
default:
return this.deliveryLocationByHoldingLocation
}
}

get deliveryLocationByHoldingLocation () {
if (this.nyplCoreLocation?.sierraDeliveryLocations?.length) {
// It's mapped, but the sierraDeliveryLocation entities only have `code` and `label`
// Do a second lookup to populate `deliveryLocationTypes`
return this.nyplCoreLocation.sierraDeliveryLocations.map((deliveryLocation) => {
deliveryLocation.deliveryLocationTypes = this.nyplCoreLocation.deliveryLocationTypes
return deliveryLocation
})
return this.nyplCoreLocation?.sierraDeliveryLocations
}
}

Expand Down
1 change: 0 additions & 1 deletion lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ module.exports = function (app, _private = null) {
// The resolved values of Promise.all are strictly ordered based on original array of promises
const items = resp[0]
const scholarRoom = resp[1]

// Use HTC API and nypl-core mappings to ammend ES response with deliveryLocations:
return Promise.all(items.map(async (item) => Item.withDeliveryLocationsByBarcode(item, scholarRoom)))
.catch((e) => {
Expand Down
40 changes: 29 additions & 11 deletions test/integration/delivery-locations-by-barcode.test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
require('dotenv').config('config/qa.env')
const axios = require('axios')
const { loadConfig } = require('../../lib/load-config')
const { expectations, ptypes } = require('./delivery-locations-constants')
const { makeNyplDataApiClient } = require('../../lib/data-api-client')

const checkLocationsForPtype = async (ptype) => {
const problems = []
const match = []
await Promise.all(Object.values(expectations).map(async (expectation) => {
const deliveryLocationsFromApi = await getDeliveryLocations(expectation.barcode, ptypes[ptype])

await Promise.all(Object.entries(expectations).map(async ([holdingLocation, expectation], i) => {
let deliveryLocationsFromApi
let totalMatch = true
const registerProblem = (problem) => {
problems.push({ barcode: expectation.barcode, deliveryLocationsFromApi, ...problem })
problems.push({ holdingLocation, barcode: expectation.barcode, deliveryLocationsFromApi, ...problem })
totalMatch = false
}
try {
deliveryLocationsFromApi = await getDeliveryLocations(expectation.barcode, ptypes[ptype])
} catch (e) {
registerProblem({ lookUpFailed: true })
return
}

const checkForValue = (expectedValue, action) => {
const includedValueIncluded = deliveryLocationsFromApi.some((label) => label.includes(expectedValue))
const match = action === 'include' ? includedValueIncluded : !includedValueIncluded
Expand All @@ -27,20 +35,30 @@ const checkLocationsForPtype = async (ptype) => {
}

const getDeliveryLocations = async (barcode, patronId) => {
const { data: { itemListElement: deliveryLocationsPerRecord } } = await axios.get(`http://localhost:8082/api/v0.1/request/deliveryLocationsByBarcode?barcodes[]=${barcode}&patronId=${patronId}`)
// per record
return deliveryLocationsPerRecord[0]
.deliveryLocation.map(loc => loc.prefLabel.toLowerCase())
try {
const { itemListElement: itemData } = await makeNyplDataApiClient().get(`request/deliveryLocationsByBarcode?barcodes[]=${barcode}&patronId=${patronId}`)
// per record
return itemData[0]
.deliveryLocation.map(loc => loc.prefLabel.toLowerCase())
} catch (e) {
console.error(e)
}
}

const theThing = async () => {
await loadConfig()
const results = await Promise.all(Object.keys(ptypes).map((checkLocationsForPtype)))
Object.keys(ptypes).forEach((ptype, i) => {
const resultsHaveProblems = Object.keys(ptypes).some((ptype, i) => {
const resultsForPtype = results[i]
if (resultsForPtype.problems.length) {
console.error(`Error with ${ptype} ptype delivery results, `, resultsForPtype.problems)
} else console.log(`All delivery location checks for ${ptype} patron type successful`)
return true
} else {
console.log(`All delivery location checks for ${ptype} patron type successful`)
return false
}
})
if (resultsHaveProblems) throw new Error('Delivery location checks failed.')
}

theThing()
10 changes: 5 additions & 5 deletions test/integration/delivery-locations-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ const expectations = {
scholar: { includes: [schomburg], excludes: [scholar, sasb, lpa] },
general: { includes: [schomburg], excludes: [scholar, sasb, lpa] }
},
// nyplM1: {
// barcode: null,
// scholar: { includes: [sasb], excludes: [scholar, lpa, schomburg] },
// general: { includes: [sasb], excludes: [scholar, lpa, schomburg] }
// },
nyplM1: {
barcode: '33433084847221',
scholar: { includes: [sasb], excludes: [scholar, lpa, schomburg] },
general: { includes: [sasb], excludes: [scholar, lpa, schomburg] }
},
nyplM2: {
barcode: '33333069027734',
scholar: { includes: [sasb, scholar], excludes: [lpa, schomburg] },
Expand Down
Loading