Skip to content

Commit

Permalink
Replace all nonNypl naming with partner
Browse files Browse the repository at this point in the history
  • Loading branch information
dgcohen committed Nov 7, 2023
1 parent 72195aa commit 0a751f2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion __test__/fixtures/itemFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export const itemUnavailable = {
},
}

export const itemNonNYPLReCAP = {
export const itemPartnerReCAP = {
"@id": "res:ci1628993",
accessMessage: [
{
Expand Down
4 changes: 2 additions & 2 deletions src/models/Item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type SearchResultsBib from "./SearchResultsBib"
import {
itemAvailableIds,
defaultNYPLLocation,
nonNYPLDefaultLocation,
partnerDefaultLocation,
locationEndpointsMap,
} from "../utils/itemUtils"

Expand Down Expand Up @@ -66,7 +66,7 @@ export default class Item {
// Pre-processing logic for setting Item holding location
getLocationFromItem(item: SearchResultsItem): ItemLocation {
let location = defaultNYPLLocation
if (this.isPartnerReCAP) location = nonNYPLDefaultLocation
if (this.isPartnerReCAP) location = partnerDefaultLocation

// Check for existence of Location object in API response
const itemLocationFromAPI = item.holdingLocation?.length
Expand Down
12 changes: 6 additions & 6 deletions src/models/modelTests/Item.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
itemPhysicallyRequestable,
itemEddRequestable,
itemUnavailable,
itemNonNYPLReCAP,
itemPartnerReCAP,
itemNYPLReCAP,
} from "../../../__test__/fixtures/itemFixtures"
import { searchResultPhysicalItems } from "../../../__test__/fixtures/searchResultPhysicalItems"
Expand Down Expand Up @@ -89,21 +89,21 @@ describe("Item model", () => {
})

describe("ReCAP checks", () => {
let nonNyplRecap: Item
let partnerRecap: Item
let nyplRecap: Item
beforeEach(() => {
nonNyplRecap = new Item(itemNonNYPLReCAP, parentBib)
partnerRecap = new Item(itemPartnerReCAP, parentBib)
nyplRecap = new Item(itemNYPLReCAP, parentBib)
})

it("determines if an item is reCAP", () => {
expect(nonNyplRecap.isReCAP).toBe(true)
expect(partnerRecap.isReCAP).toBe(true)
expect(nyplRecap.isReCAP).toBe(true)
})

it("determines if an item is nypl-owned reCAP or non-nypl Recap", () => {
expect(nonNyplRecap.isNYPLReCAP()).toBe(false)
expect(nonNyplRecap.isPartnerReCAP()).toBe(true)
expect(partnerRecap.isNYPLReCAP()).toBe(false)
expect(partnerRecap.isPartnerReCAP()).toBe(true)

expect(nyplRecap.isNYPLReCAP()).toBe(true)
expect(nyplRecap.isPartnerReCAP()).toBe(false)
Expand Down
4 changes: 2 additions & 2 deletions src/utils/itemUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export const defaultNYPLLocation: ItemLocation = {
customerCode: "",
}

// Default delivery location for a nonNyplRecap item.
export const nonNYPLDefaultLocation: ItemLocation = {
// Default delivery location for a partner Recap item.
export const partnerDefaultLocation: ItemLocation = {
"@id": "",
prefLabel: "Off-site",
customerCode: "",
Expand Down

0 comments on commit 0a751f2

Please sign in to comment.