Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scc 4334/replace owning institution #405

Merged
merged 11 commits into from
Dec 4, 2024
4 changes: 2 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## Prerelease

### Updated

- Pull in Owning institution from items to populate bib details ([SCC-4334](https://newyorkpubliclibrary.atlassian.net/browse/SCC-4334))
- Refactor bib details model so most non-url properties return value, not object with value and label
- add call number and standard numbers to advanced search ([SCC-4326](https://newyorkpubliclibrary.atlassian.net/browse/SCC-4326))

## Unreleased
Expand All @@ -19,7 +20,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated phone, email, notification preference and home library to be individually editable in Account Settings (SCC-4337, SCC-4254, SCC-4253)
- Updated username to be editable in My Account header (SCC-4236)


## [1.3.6] 2024-11-6

## Added
Expand Down
177 changes: 177 additions & 0 deletions __test__/fixtures/bibFixtures.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,180 @@
export const princetonRecord = {
"@context":
"http://discovery-api-qa.nypl.org/api/v0.1/discovery/context_all.jsonld",
"@type": ["nypl:Item", "nypl:Resource"],
"@id": "res:pb2608686",
buildingLocationIds: [],
carrierType: [
{
"@id": "carriertypes:nc",
prefLabel: "volume",
},
],
contributorLiteral: ["Brown, David, journalist, joint author."],
createdString: ["1943"],
createdYear: 1943,
creatorLiteral: ["Wagg, Alfred."],
dateStartYear: 1943,
dateString: ["1943"],
dimensions: ["23 cm."],
extent: ["231 p."],
idLccn: [" 44003956 "],
identifier: [
{
"@type": "nypl:Bnumber",
"@value": "2608686",
},
{
"@type": "bf:Lccn",
"@value": " 44003956 ",
},
{
"@type": "bf:Identifier",
"@value": "(OCoLC)ocm02088006",
},
],
issuance: [
{
"@id": "urn:biblevel:m",
prefLabel: "monograph/item",
},
],
itemAggregations: [
{
"@type": "nypl:Aggregation",
"@id": "res:location",
id: "location",
field: "location",
values: [],
},
{
"@type": "nypl:Aggregation",
"@id": "res:format",
id: "format",
field: "format",
values: [],
},
{
"@type": "nypl:Aggregation",
"@id": "res:status",
id: "status",
field: "status",
values: [
{
value: "status:a",
count: 1,
label: "Available",
},
],
},
],
items: [
{
"@id": "res:pi5153471",
accessMessage: [
{
"@id": "accessMessage:1",
prefLabel: "Use in library",
},
],
catalogItemType: [
{
"@id": "catalogItemType:1",
prefLabel: "non-circ",
},
],
eddFulfillment: {
"@id": "fulfillment:recap-edd",
},
eddRequestable: true,
idBarcode: ["32101067443802"],
identifier: [
{
"@type": "bf:ShelfMark",
"@value": "D763.I8 W3 1943",
},
{
"@type": "bf:Barcode",
"@value": "32101067443802",
},
],
idNyplSourceId: {
"@type": "RecapPul",
"@value": "25791623",
},
owner: [
{
"@id": "orgs:0003",
prefLabel: "Princeton University Library",
},
],
physFulfillment: {
"@id": "fulfillment:recap-offsite",
},
physRequestable: true,
requestable: [true],
shelfMark: ["D763.I8 W3 1943"],
specRequestable: false,
status: [
{
"@id": "status:na",
prefLabel: "Not available",
},
],
uri: "pi5153471",
},
],
language: [
{
"@id": "lang:eng",
prefLabel: "English",
},
],
lccClassification: ["D763.I8 W3"],
materialType: [
{
"@id": "resourcetypes:txt",
prefLabel: "Text",
},
],
mediaType: [
{
"@id": "mediatypes:n",
prefLabel: "unmediated",
},
],
note: [
{
noteType: "Note",
"@type": "bf:Note",
prefLabel: '"First published in 1943."',
},
],
numAvailable: 1,
numItems: 1,
numItemsMatched: 1,
numItemsTotal: 1,
placeOfPublication: ["London,"],
publicationStatement: ["London, Nicholson & Watson [1943]"],
publisherLiteral: ["Nicholson & Watson"],
subjectLiteral: [
"World War, 1939-1945 -- Campaigns -- Italy.",
"World War, 1939-1945 -- Naval operations.",
"World War, 1939-1945 -- Personal narratives.",
],
title: ["No spaghetti for breakfast"],
titleDisplay: [
"No spaghetti for breakfast [by] Alfred Wagg and David Brown.",
],
type: ["nypl:Item"],
updatedAt: 1543536484228,
uri: "pb2608686",
updatedAtDate: "2018-11-30T00:08:04.228Z",
hasItemVolumes: false,
hasItemDates: false,
electronicResources: [],
}

export const bibWithItems = {
resource: {
"@context":
Expand Down
7 changes: 3 additions & 4 deletions __test__/pages/search/searchResults.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import userEvent from "@testing-library/user-event"
import { render, screen } from "../../../src/utils/testUtils"
import { render, screen, waitFor } from "../../../src/utils/testUtils"

import mockRouter from "next-router-mock"

Expand Down Expand Up @@ -32,11 +32,10 @@ describe("Search Results page", () => {
})
await userEvent.click(field)
await userEvent.click(screen.getByText("Apply filters"))
// This was the only way to get this test to pass. waitFor was not in fact waiting, even with same timeout.
setTimeout(() => {
Comment on lines -35 to -36
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did this change now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure. it was not passing, so I changed it to waitFor, and the test started passing.

waitFor(() => {
const resultsHeading = screen.getByTestId("search-results-heading")
expect(resultsHeading).toHaveFocus()
}, 500)
})
})
it("focuses on search results heading after loading a keyword search", () => {
mockRouter.push(`/search?q=${query}`)
Expand Down
1 change: 0 additions & 1 deletion pages/bib/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export default function BibPage({
discoveryBibResult,
annotatedMarc
)

const displayLegacyCatalogLink = isNyplBibID(bib.id)

const filtersAreApplied = areFiltersApplied(appliedFilters)
Expand Down
1 change: 0 additions & 1 deletion src/components/BibPage/BibDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import type {
} from "../../types/bibDetailsTypes"
import { rtlOrLtr, isItTheLastElement } from "../../utils/bibUtils"
import type { ReactNode } from "react"
import { BASE_URL } from "../../config/constants"

interface BibDetailsProps {
details: AnyBibDetail[]
Expand Down
Loading
Loading