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-0898 - Search Results View All Link #56

Merged
merged 5 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
323 changes: 323 additions & 0 deletions __test__/fixtures/searchResultManyPhysicalItems.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,323 @@
export const searchResultManyPhysicalItems = {
"@type": ["nypl:Item", "nypl:Resource"],
"@id": "res:b14753192",
carrierType: [
{
"@id": "carriertypes:nc",
prefLabel: "volume",
},
],
createdString: ["190"],
createdYear: 190,
dateStartYear: 190,
dateString: ["190"],
dimensions: ["20 cm."],
electronicResources: [],
extent: ["18 p. : col. ill. ;"],
identifier: [
{
"@type": "bf:ShelfMark",
"@value": "*ZO-*OSH p.v. 3, no. 2",
},
{
"@type": "nypl:Bnumber",
"@value": "14753192",
},
{
"@type": "bf:Identifier",
"@value": "(WaOLN)R310002230",
},
],
issuance: [
{
"@id": "urn:biblevel:m",
prefLabel: "monograph/item",
},
],
items: [
{
"@id": "res:i14507546",
accessMessage: [
{
"@id": "accessMessage:4",
prefLabel: "Restricted use",
},
],
catalogItemType: [
{
"@id": "catalogItemType:2",
prefLabel: "book non-circ",
},
],
eddRequestable: false,
holdingLocation: [
{
"@id": "loc:macc2",
prefLabel: "Schwarzman Building - Arents Collection Room 328",
endpoint: "schwarzman",
},
],
identifier: [
{
"@type": "bf:ShelfMark",
"@value": "Arents BIP (Hearn. Japanese) AL 04-11 [Text]",
},
],
owner: [
{
"@id": "orgs:1109",
prefLabel: "George Arents Collection",
},
],
physRequestable: false,
physicalLocation: ["Arents BIP (Hearn. Japanese) AL 04-11 [Text]"],
requestable: [false],
shelfMark: ["Arents BIP (Hearn. Japanese) AL 04-11 [Text]"],
specRequestable: false,
status: [
{
"@id": "status:a",
prefLabel: "Available",
},
],
uri: "i14507546",
idNyplSourceId: {
"@type": "SierraNypl",
"@value": "14507546",
},
},
{
"@id": "res:i14507545",
accessMessage: [
{
"@id": "accessMessage:p",
prefLabel: "Permit needed",
},
],
catalogItemType: [
{
"@id": "catalogItemType:6",
prefLabel: "microfilm service copy",
},
],
eddRequestable: false,
holdingLocation: [
{
"@id": "loc:mai82",
prefLabel: "Schwarzman Building M1 - Microforms Room 315",
endpoint: "schwarzman",
},
],
identifier: [
{
"@type": "bf:ShelfMark",
"@value": "*ZO-*OSH p.v. 3, no. 2",
},
],
owner: [
{
"@id": "orgs:1101",
prefLabel: "General Research Division",
},
],
physRequestable: false,
physicalLocation: ["*ZO-*OSH p.v. 3, no. 2"],
requestable: [false],
shelfMark: ["*ZO-*OSH p.v. 3, no. 2"],
specRequestable: false,
status: [
{
"@id": "status:a",
prefLabel: "Available",
},
],
uri: "i14507545",
idNyplSourceId: {
"@type": "SierraNypl",
"@value": "14507545",
},
},
{
"@id": "res:i14507543",
accessMessage: [
{
"@id": "accessMessage:p",
prefLabel: "Permit needed",
},
],
catalogItemType: [
{
"@id": "catalogItemType:6",
prefLabel: "microfilm service copy",
},
],
eddRequestable: true,
holdingLocation: [
{
"@id": "loc:rcmi2",
prefLabel: "Offsite",
},
],
idBarcode: ["33433105668333"],
identifier: [
{
"@type": "bf:ShelfMark",
"@value": "*ZO-*OSH p.v. 3, no. 1",
},
{
"@type": "bf:Barcode",
"@value": "33433105668333",
},
],
owner: [
{
"@id": "orgs:1000",
prefLabel: "Stephen A. Schwarzman Building",
},
],
physRequestable: true,
physicalLocation: ["*ZO-*OSH p.v. 3, no. 1"],
recapCustomerCode: ["NA"],
requestable: [true],
shelfMark: ["*ZO-*OSH p.v. 3, no. 1"],
specRequestable: false,
status: [
{
"@id": "status:a",
prefLabel: "Available",
},
],
uri: "i14507543",
idNyplSourceId: {
"@type": "SierraNypl",
"@value": "14507543",
},
},
{
"@id": "res:i30068374",
accessMessage: [
{
"@id": "accessMessage:2",
prefLabel: "Request in advance",
},
],
catalogItemType: [
{
"@id": "catalogItemType:6",
prefLabel: "microfilm service copy",
},
],
eddRequestable: true,
enumerationChronology: ["*OSH p.v. 1-2"],
holdingLocation: [
{
"@id": "loc:rcmi2",
prefLabel: "Offsite",
},
],
idBarcode: ["33433105668325"],
identifier: [
{
"@type": "bf:ShelfMark",
"@value": "*ZO-*OSH p.v. 1, no. 1 *OSH p.v. 1-2",
},
{
"@type": "bf:Barcode",
"@value": "33433105668325",
},
],
owner: [
{
"@id": "orgs:1000",
prefLabel: "Stephen A. Schwarzman Building",
},
],
physRequestable: true,
physicalLocation: ["*ZO-*OSH p.v. 1, no. 1"],
recapCustomerCode: ["NA"],
requestable: [true],
shelfMark: ["*ZO-*OSH p.v. 1, no. 1 *OSH p.v. 1-2"],
specRequestable: false,
status: [
{
"@id": "status:a",
prefLabel: "Available",
},
],
uri: "i30068374",
idNyplSourceId: {
"@type": "SierraNypl",
"@value": "30068374",
},
},
],
language: [
{
"@id": "lang:eng",
prefLabel: "English",
},
],
materialType: [
{
"@id": "resourcetypes:txt",
prefLabel: "Text",
},
],
mediaType: [
{
"@id": "mediatypes:n",
prefLabel: "unmediated",
},
],
note: [
{
noteType: "Note",
"@type": "bf:Note",
prefLabel: "Cover title.",
},
{
noteType: "Note",
"@type": "bf:Note",
prefLabel: "Printed on double leaves folded in Japanese fashion.",
},
{
noteType: "Note",
"@type": "bf:Note",
prefLabel: "Name of second publisher from stamp on t.p. verso.",
},
{
noteType: "Indexed In",
"@type": "bf:Note",
prefLabel: "BAL",
},
{
noteType: "Reproduction",
"@type": "bf:Note",
prefLabel: "Microfilm.",
},
],
numAvailable: 4,
numElectronicResources: 0,
numItems: 4,
numItemsMatched: 4,
numItemsTotal: 4,
nyplSource: ["sierra-nypl"],
placeOfPublication: ["Tokyo : [London] :"],
publicationStatement: [
"Tokyo : T. Hasegawa ; [London] : Martin Hopkinson & Co., [190-?]",
],
publisherLiteral: ["T. Hasegawa ; Martin Hopkinson & Co.,"],
shelfMark: ["*ZO-*OSH p.v. 3, no. 2"],
subjectLiteral: ["Fairy tales -- Japan."],
title: ["The boy who drew cats [microform]"],
titleAlt: ["Japanese fairy tale"],
titleDisplay: [
"The boy who drew cats [microform] / rendered into English, by Lafcadio Hearn.",
],
type: ["nypl:Item"],
updatedAt: 1636582835709,
uri: "b14753192",
suppressed: false,
hasItemVolumes: false,
hasItemDates: false,
}
18 changes: 18 additions & 0 deletions src/components/SearchResult/SearchResult.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { render, screen } from "@testing-library/react"
import SearchResult from "./SearchResult"
import SearchResultsBib from "../../models/SearchResultsBib"
import { searchResultPhysicalItems } from "../../../__test__/fixtures/searchResultPhysicalItems"
import { searchResultManyPhysicalItems } from "../../../__test__/fixtures/searchResultManyPhysicalItems"
import { searchResultElectronicResources } from "../../../__test__/fixtures/searchResultElectronicResources"

describe("SearchResult with Physical Items", () => {
Expand All @@ -26,6 +27,23 @@ describe("SearchResult with Physical Items", () => {
})
})

describe("SearchResult with Many Physical Items", () => {
beforeEach(() => {
const bib = new SearchResultsBib(searchResultManyPhysicalItems)
render(<SearchResult bib={bib} />)
})

it("renders a link to the bib page with the correct text when there are more than the set limit of items per search result", async () => {
const resultTitleLink = screen.getByRole("link", {
name: "View All 4 Items",
})
expect(resultTitleLink).toHaveAttribute(
"href",
"/bib/b14753192#items-table"
)
})
})

describe("SearchResult with Electronic Resources", () => {
it("renders the correct item message for bib with electronic resources", async () => {
const bib = new SearchResultsBib(searchResultElectronicResources)
Expand Down
Loading