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 4142/spec coll messaging #421

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
fcc1c3a
add build avail key and use switch statment
charmingduchess Dec 17, 2024
c9e8075
extract contact a librarian
charmingduchess Dec 17, 2024
dba9aa8
extract all availability messaging
charmingduchess Dec 17, 2024
879ef5b
move availability componetns to model
charmingduchess Dec 17, 2024
9d67c2e
use constants for avail keys
charmingduchess Dec 17, 2024
287ba38
use consttants for keys
charmingduchess Dec 17, 2024
d2415ef
add finding aid to bib model;
charmingduchess Dec 17, 2024
c59596f
add finding aid to item and availability models
charmingduchess Dec 17, 2024
383a6f9
start to split aeon statuses
charmingduchess Dec 17, 2024
03cb92f
actual refactor
charmingduchess Dec 17, 2024
d4d0cf6
clean up;
charmingduchess Dec 17, 2024
ca84fb8
move message render to component
charmingduchess Dec 17, 2024
39f8c10
start availability model tests
charmingduchess Dec 17, 2024
bc233b0
more tests for item availability
charmingduchess Dec 17, 2024
b71027e
create all cases in model
charmingduchess Dec 18, 2024
790e7bb
start speccoll tests
charmingduchess Dec 18, 2024
13a0c72
rm non avail details from itemavailability
charmingduchess Dec 18, 2024
2c591bd
more tests
charmingduchess Dec 18, 2024
3ac3d6f
build out rendering cases and tests
charmingduchess Dec 18, 2024
4b5730b
add provisional special collections designation
charmingduchess Dec 18, 2024
caf8731
fix bib/item instantiation bug
charmingduchess Dec 19, 2024
17628f4
add test for bibs and finding aid
charmingduchess Dec 19, 2024
a923226
update to specRequestable and variable casing of finding aid
charmingduchess Dec 19, 2024
a4cf18d
fix recap aeon only case
charmingduchess Dec 19, 2024
115ec56
update request buttons to remove ternary
charmingduchess Dec 19, 2024
57beae1
formatting periods
charmingduchess Dec 19, 2024
74b8e76
fix periods in tests
charmingduchess Dec 20, 2024
a04fe17
return recap general collections message from switch
charmingduchess Dec 20, 2024
5fb0ea1
fix types
charmingduchess Dec 20, 2024
a4be195
return component instead of string
charmingduchess Dec 20, 2024
e997956
replace platform urls
charmingduchess Dec 20, 2024
70f97b1
fix string return
charmingduchess Dec 20, 2024
132661f
rm link from onsite no finding aid no aeon
charmingduchess Dec 23, 2024
eb13be4
rm dash from contactALibrarian component
charmingduchess Dec 23, 2024
de6c2ec
add dash to not available
charmingduchess Dec 23, 2024
7d13a04
move dash
charmingduchess Dec 23, 2024
8c8cddc
add finding aid status badge
charmingduchess Dec 23, 2024
be7bafa
move statusbadge above bib title
charmingduchess Dec 23, 2024
d757054
rm finding aid from electronic resources
charmingduchess Dec 23, 2024
68060ac
add finding aid card to search result
charmingduchess Dec 23, 2024
e7b4ec2
add finding aid information panel
charmingduchess Dec 23, 2024
9fb9fde
fix spacing on finding aid and electronic resources cards
charmingduchess Dec 23, 2024
d9e14eb
update tests for finding aid additions
charmingduchess Dec 23, 2024
81b9cf8
fix spacing
charmingduchess Dec 23, 2024
35d8fc3
move finding aid out of grid
charmingduchess Dec 24, 2024
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
1,465 changes: 1,465 additions & 0 deletions __test__/fixtures/bibFixtures.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions __test__/fixtures/itemFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const itemPhysicallyRequestable = {
prefLabel: "Use in library",
},
],
specialCollections: true,
aeonUrl: [
"https://specialcollections.nypl.org/aeon/Aeon.dll?Action=10&Form=30&Title=Spaghetti+westerns.&Site=LPAMRAMI&CallNumber=*LDC+14245&ItemPlace=[New+York?]+:&ItemPublisher=DRG+Records+Inc.,&Date=p1995.&ItemInfo3=https://catalog.nypl.org/record=b19028235&ReferenceNumber=b190282356&ItemInfo1=USE+IN+LIBRARY&ItemNumber=33433085319782&ItemISxN=i265238791&Genre=Music+CD&Location=Performing+Arts+Music+Division",
],
Expand Down
151 changes: 143 additions & 8 deletions src/components/ItemTable/ItemAvailability.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from "react"
import { render, screen } from "../../utils/testUtils"
import userEvent from "@testing-library/user-event"

import ItemAvailabilityModel from "../../models/ItemAvailability"

import ItemAvailability from "./ItemAvailability"
import Item from "../../models/Item"
import SearchResultsBib from "../../models/SearchResultsBib"
Expand All @@ -13,10 +15,151 @@ import {
itemUnavailable,
} from "../../../__test__/fixtures/itemFixtures"
import { searchResultPhysicalItems } from "../../../__test__/fixtures/searchResultPhysicalItems"
import { notDeepEqual } from "assert"

const parentBib = new SearchResultsBib(searchResultPhysicalItems)

describe("ItemAvailability", () => {
describe("special collections", () => {
it("onsite aeon finding aid", () => {
const item = new Item(itemPhysicallyRequestable, parentBib)
item.availability = new ItemAvailabilityModel({
isAvailable: true,
isReCAP: false,
aeonUrl: "spaghetti.com",
findingAid: "meatballs.com",
isSpecRequestable: true,
})
render(<ItemAvailability item={item} />)
expect(screen.getByText("Available by appointment")).toBeInTheDocument()
expect(screen.getByRole("link")).toHaveTextContent(
"Schwarzman Building - Main Reading Room 315"
)
})
it("recap aeon finding aid", () => {
const item = new Item(itemPhysicallyRequestable, parentBib)
item.availability = new ItemAvailabilityModel({
isAvailable: true,
isReCAP: true,
aeonUrl: "spaghetti.com",
findingAid: "meatballs.com",
isSpecRequestable: true,
})
render(<ItemAvailability item={item} />)
expect(screen.getByText("Available by appointment.")).toBeInTheDocument()
expect(screen.queryByRole("link")).not.toBeInTheDocument()
expect(
screen.queryByText("Schwarzman Building - Main Reading Room 315")
).not.toBeInTheDocument()
})
it("recap aeon", () => {
const item = new Item(itemPhysicallyRequestable, parentBib)
item.availability = new ItemAvailabilityModel({
isAvailable: true,
isReCAP: true,
aeonUrl: "spaghetti.com",
findingAid: "meatballs.com",
isSpecRequestable: true,
})
render(<ItemAvailability item={item} />)
expect(screen.getByText("Available by appointment.")).toBeInTheDocument()
expect(screen.queryByRole("link")).not.toBeInTheDocument()
expect(
screen.queryByText("Schwarzman Building - Main Reading Room 315")
).not.toBeInTheDocument()
})
it("onsite aeon NO finding aid", () => {
const item = new Item(itemPhysicallyRequestable, parentBib)
item.availability = new ItemAvailabilityModel({
isAvailable: true,
isReCAP: false,
aeonUrl: "spaghetti.com",
findingAid: null,
isSpecRequestable: true,
})
render(<ItemAvailability item={item} />)
expect(screen.getByText("Available by appointment")).toBeInTheDocument()
expect(screen.queryByRole("link")).not.toBeInTheDocument()
expect(
screen.getByText("at Schwarzman Building - Main Reading Room 315.")
).toBeInTheDocument()
})
it("onsite NO aeon YES finding aid", () => {
const item = new Item(itemPhysicallyRequestable, parentBib)
item.availability = new ItemAvailabilityModel({
isAvailable: true,
isReCAP: false,
aeonUrl: null,
findingAid: "meatballs.com",
isSpecRequestable: true,
})
render(<ItemAvailability item={item} />)
expect(screen.getByText("Available by appointment")).toBeInTheDocument()
expect(screen.queryByRole("link")).toHaveTextContent("finding aid")
expect(
screen.getByText(
"at Schwarzman Building - Main Reading Room 315. See the ",
{ exact: false }
)
).toBeInTheDocument()
})
it("recap NO aeon YES finding aid", () => {
const item = new Item(itemPhysicallyRequestable, parentBib)
item.availability = new ItemAvailabilityModel({
isAvailable: true,
isReCAP: true,
aeonUrl: null,
findingAid: "meatballs.com",
isSpecRequestable: true,
})
render(<ItemAvailability item={item} />)
expect(screen.getByText("Available by appointment.")).toBeInTheDocument()
expect(screen.queryByRole("link")).toHaveTextContent("finding aid")
expect(
screen.queryByText("Schwarzman Building - Main Reading Room 315", {
exact: false,
})
).not.toBeInTheDocument()
})
it("recap NO aeon NO finding aid", () => {
const item = new Item(itemPhysicallyRequestable, parentBib)
item.availability = new ItemAvailabilityModel({
isAvailable: true,
isReCAP: true,
aeonUrl: null,
findingAid: null,
isSpecRequestable: true,
})
render(<ItemAvailability item={item} />)
expect(screen.getByText("Available by appointment.")).toBeInTheDocument()
expect(screen.queryByRole("link")).not.toBeInTheDocument()
expect(
screen.queryByText("Schwarzman Building - Main Reading Room 315", {
exact: false,
})
).not.toBeInTheDocument()
expect(screen.getByText("contact a librarian")).toBeInTheDocument()
})
it("onsite NO aeon NO finding aid", () => {
const item = new Item(itemPhysicallyRequestable, parentBib)
item.availability = new ItemAvailabilityModel({
isAvailable: true,
isReCAP: false,
aeonUrl: null,
findingAid: null,
isSpecRequestable: true,
})
render(<ItemAvailability item={item} />)
expect(screen.getByText("Available by appointment")).toBeInTheDocument()
expect(screen.queryByRole("link")).not.toBeInTheDocument()
expect(
screen.queryByText("Schwarzman Building - Main Reading Room 315.", {
exact: false,
})
).toBeInTheDocument()
expect(screen.getByText("contact a librarian")).toBeInTheDocument()
})
})
it("renders the correct link when item is available, is reCAP, and does not have an aeon url", async () => {
const item = new Item(itemNYPLReCAP, parentBib)
render(<ItemAvailability item={item} />)
Expand All @@ -27,14 +170,6 @@ describe("ItemAvailability", () => {
"https://www.nypl.org/help/request-research-materials"
)
})
it("renders the correct text when item is available, has an aeon url, and has a location endpoint", async () => {
const item = new Item(itemPhysicallyRequestable, parentBib)
render(<ItemAvailability item={item} />)
expect(screen.getByText("Available by appointment")).toBeInTheDocument()
expect(
screen.getByText("Schwarzman Building - Main Reading Room 315")
).toHaveAttribute("href", "https://www.nypl.org/locations/schwarzman")
})
it("renders the correct text for an available onsite item", async () => {
const item = new Item(itemAvailableOnsite, parentBib)
render(<ItemAvailability item={item} />)
Expand Down
Loading
Loading