-
Notifications
You must be signed in to change notification settings - Fork 565
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
fix: follow up on Purchase button on artwork screen with partner offer #10148
fix: follow up on Purchase button on artwork screen with partner offer #10148
Conversation
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.
@@ -50,11 +53,14 @@ export const ArtworkCommercialButtons: React.FC<ArtworkCommercialButtonsProps> = | |||
isBiddableInAuction | |||
const noEditions = !artworkData.editionSets || artworkData.editionSets.length === 0 | |||
|
|||
const hasActivePartnerOffer = |
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.
praise: better naming!
Me: () => meWithPartnerOfferFixture, | ||
}) | ||
|
||
expect(screen.getByText("Purchase")).toBeOnTheScreen() |
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 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.
LGTM - one non-blocking comment.
}, | ||
}), | ||
}) | ||
) |
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.
#minor: mockResolveLastOperation
does not return a promise, so this might change behavior slightly. I think it's possible that waitFor
will wait until the operation resolver is called without error (ie protect from the test running before the operation is queued in the relay environment) but before the result triggers the side effect.
We might want to waitFor the expectation after it but if the test runs reliably as-is, non-blocking.
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.
Wrapping the expectation inside a waitFor
always gives a false positive.
At first, I wrapped the expectation inside a waitFor
and it passed, but I had a suspicion and expected "sup" to be on the screen, and it passed 😅 then I removed the waitFor
and it failed due to the wrong expectation
const selectedEditionId = ArtworkStore.useStoreState((state) => state.selectedEditionId) | ||
const auctionState = ArtworkStore.useStoreState((state) => state.auctionState) | ||
|
||
const AREnablePartnerOfferOnArtworkScreen = useFeatureFlag("AREnablePartnerOfferOnArtworkScreen") | ||
const { hasEnded: partnerOfferEnded } = getTimer(partnerOfferData?.endAt || "") |
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.
#non-blocking. Not sure if we need to check the time again given that the endpoint only returns active partner offers.
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 might be new, but I mentioned an issue in Slack 🔐 that the offer shows up even if it's sold already
@@ -156,6 +162,19 @@ export const ArtworkCommercialButtons: React.FC<ArtworkCommercialButtonsProps> = | |||
} | |||
|
|||
if (artworkData.isInquireable) { | |||
if (hasActivePartnerOffer) { |
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 catch! I missed it in the previous PR as I thought it would have MOOAEA enabled, but I guess I was wong.
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.
LGTM! And thank you for the 25 screenshots!! 🥇
This PR resolves []
Description
This PR is a follow-up on #10144
This PR includes a missing state when the artwork is only inquiriable with a partner offer to show the Purchase button
It also refactors the tests for the ArtworkCommercialButtons component
Screenshots
Details
States
isAcquireable
+isOfferable
isAcquireable
isOfferable
+isInquireable
isOfferable
isInquireable
iOS
isAcquireable
+isOfferable
isAcquireable
isOfferable
+isInquireable
isOfferable
isInquireable
Android
isOfferable
+isAcquireable
isAcquireable
isOfferable
+isInquireable
isOfferable
isInquireable
PR Checklist
To the reviewers 👀
Changelog updates
Changelog updates
Cross-platform user-facing changes
iOS user-facing changes
Android user-facing changes
Dev changes
Need help with something? Have a look at our docs, or get in touch with us.