-
Notifications
You must be signed in to change notification settings - Fork 0
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 no findin #430
Scc 4142/spec coll no findin #430
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -1,6 +1,7 @@ | |||
## Ticket: | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm down with this change, but did you mean to put this outside the parens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't push up the final update to this! yes it should be
case RECAP_AEON: | ||
case RECAP_AEON_FINDING_AID: | ||
message = ( | ||
<> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit: fragment isn't needed here
case EDGE_CASE: | ||
message = <ContactALibrarian item={itemMetadata} /> | ||
break | ||
case RECAP_AEON: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this case meant to be blank?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not blank, it is combined with the one after it
|
||
const AvailableByAppointment = ({ displayPeriod = false }) => { | ||
return ( | ||
<> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit: fragment isn't needed here
src/config/constants.ts
Outdated
@@ -134,3 +134,22 @@ export const NYPL_LOCATIONS = { | |||
address: "476 Fifth Avenue (42nd St and Fifth Ave)", | |||
}, | |||
} | |||
|
|||
export const availabilityKeys = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very small nit: I know we haven't settled on naming conventions yet but can you rename to AVAILABILITY_KEYS to match the other constants?
will re-review once the last test is fixed, but looks good! just added some small nitpicky comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few questions/comments.
@@ -13,10 +15,153 @@ import { | |||
itemUnavailable, | |||
} from "../../../__test__/fixtures/itemFixtures" | |||
import { searchResultPhysicalItems } from "../../../__test__/fixtures/searchResultPhysicalItems" | |||
import { notDeepEqual } from "assert" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used, remove it.
screen.queryByText("Schwarzman Building - Main Reading Room 315") | ||
).not.toBeInTheDocument() | ||
}) | ||
it("recap aeon", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a "NO finding aid" in the next test. This test also doesn't have a finding aid, right? If that's right add the same text here.
}) | ||
render(<ItemAvailability item={item} />) | ||
expect(screen.getByText("Available by appointment")).toBeInTheDocument() | ||
expect(screen.getByRole("link")).toHaveTextContent( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be the example for this case: https://research-catalog-git-scc-4142-spec-coll-messaging-nypl.vercel.app/research/research-catalog/bib/b17058276 (row 8 of spreadsheet). There should be no link but this test does have a link and it passes. Or am I missing something?
import { appConfig } from "../../../config/config" | ||
import ExternalLink from "../../Links/ExternalLink/ExternalLink" | ||
|
||
const AvailableByAppointment = ({ displayPeriod = false }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice way of solving sentence structure through react components.
|
||
const AvailableAt = ({ location }) => { | ||
if (!location?.endpoint) return null | ||
else return <> {` at ${location.prefLabel}. `}</> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you don't need a return since it will always go to this case if the statement above fails.
const ContactALibrarian = ({ | ||
item, | ||
}: { | ||
item: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary but just showing another way to type this. This is derived from the Item
class when it's used as a class. You should be able to do Pick<Item, "id" | "barcode" | "callNumber" | "bibId">
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And also reuse it in NotAvailable
if you give this its own name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats a good pattern to keep in mind! i kept going back and forth between passing the whole item and just the needed properties. Pick would have been useful.
|
||
export const availabilityKeys = { | ||
// anything not covered by the cases below is EDGE_CASE | ||
EDGE_CASE: "edgeCase", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't actually know that this case is possible, so I contrived it in the test as item.availability.key = "edgeCase"
describe("special collections", () => { | ||
it("onsite aeon finding aid", () => { | ||
const item = new Item(itemPhysicallyRequestable, parentBib) | ||
item.availability = new ItemAvailabilityModel({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets called automatically in Item
when it's initialized. Are you doing it here just for the tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea I put in in here so it would be explicit per test exactly what case was being tested. i find it messy and hard to maintain specific actual fixtures for all these different cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose I could have just updated item.availabilty.key
explicitly for each one.
screen.queryByText("Schwarzman Building - Main Reading Room 315") | ||
).not.toBeInTheDocument() | ||
}) | ||
it("recap YES aeon NO finding ait", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo "ait"
Ticket:
This PR does the following:
How has this been tested?
unit tests and visual verification
Accessibility concerns or updates
Checklist: