-
Notifications
You must be signed in to change notification settings - Fork 4
Fix calendar, fix page search, fix grouped reactions PFPs #2183
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2b69c81
Fix calendar, fix page search, fix grouped reactions PFPs
prxt6529 cb80a70
WIP
prxt6529 3459faf
Merge branch 'main' into fix-calendar-fix-page-search
prxt6529 d15be41
WIP
prxt6529 13e3d83
Merge branch 'main' into fix-calendar-fix-page-search
prxt6529 feb2de4
WIP
prxt6529 a3a9c33
Merge branch 'main' into fix-calendar-fix-page-search
prxt6529 2040789
WIP
prxt6529 909082b
WIP
prxt6529 fb4b7d9
WIP
prxt6529 9823d22
WIP
prxt6529 d783b74
WIP
prxt6529 62b83fa
WIP
prxt6529 656fe31
WIP
prxt6529 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
544 changes: 544 additions & 0 deletions
544
__tests__/components/brain/notifications/drop-reacted/NotificationDropReactedGroup.test.tsx
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| import DynamicHeadTitle from "@/components/dynamic-head/DynamicHeadTitle"; | ||
| import { | ||
| TitleProvider, | ||
| useSetWaveData, | ||
| useTitle, | ||
| } from "@/contexts/TitleContext"; | ||
| import { render, screen, waitFor } from "@testing-library/react"; | ||
|
|
||
| let mockPathname = "/waves/wave-1"; | ||
| let mockSearchParams = new URLSearchParams("divider=841669"); | ||
| let mockActiveWaveId: string | null = "wave-1"; | ||
|
|
||
| jest.mock("next/navigation", () => ({ | ||
| usePathname: () => mockPathname, | ||
| useSearchParams: () => mockSearchParams, | ||
| })); | ||
|
|
||
| jest.mock("@/contexts/wave/MyStreamContext", () => ({ | ||
| useMyStreamOptional: () => | ||
| mockActiveWaveId | ||
| ? { | ||
| activeWave: { | ||
| id: mockActiveWaveId, | ||
| set: jest.fn(), | ||
| }, | ||
| } | ||
| : null, | ||
| })); | ||
|
|
||
| function TitleHarness({ | ||
| waveData, | ||
| }: { | ||
| readonly waveData: { name: string; newItemsCount: number } | null; | ||
| }) { | ||
| useSetWaveData(waveData); | ||
| const { title } = useTitle(); | ||
| return <div>{title}</div>; | ||
| } | ||
|
|
||
| describe("TitleContext", () => { | ||
| beforeEach(() => { | ||
| mockPathname = "/waves/wave-1"; | ||
| mockSearchParams = new URLSearchParams("divider=841669"); | ||
| mockActiveWaveId = "wave-1"; | ||
| document.title = ""; | ||
| }); | ||
|
|
||
| it("resets the client title when leaving a wave for the meme calendar", async () => { | ||
| const view = render( | ||
| <TitleProvider> | ||
| <DynamicHeadTitle /> | ||
| <TitleHarness | ||
| waveData={{ name: "6529 Dev Daily Standup", newItemsCount: 0 }} | ||
| /> | ||
| </TitleProvider> | ||
| ); | ||
|
|
||
| await waitFor(() => { | ||
| expect( | ||
| screen.getByText("6529 Dev Daily Standup | Brain") | ||
| ).toBeInTheDocument(); | ||
| }); | ||
| await waitFor(() => { | ||
| expect(document.title).toBe("6529 Dev Daily Standup | Brain"); | ||
| }); | ||
|
|
||
| mockPathname = "/meme-calendar"; | ||
| mockSearchParams = new URLSearchParams(); | ||
|
|
||
| view.rerender( | ||
| <TitleProvider> | ||
| <DynamicHeadTitle /> | ||
| <TitleHarness waveData={null} /> | ||
| </TitleProvider> | ||
| ); | ||
|
|
||
| await waitFor(() => { | ||
| expect(screen.getByText("Memes Minting Calendar")).toBeInTheDocument(); | ||
| }); | ||
| await waitFor(() => { | ||
| expect(document.title).toBe("Memes Minting Calendar"); | ||
| }); | ||
| }); | ||
|
|
||
| it("resets the client title when the active wave id changes on the same route", async () => { | ||
| mockPathname = "/messages"; | ||
| mockSearchParams = new URLSearchParams("wave=wave-1"); | ||
|
|
||
| const view = render( | ||
| <TitleProvider> | ||
| <DynamicHeadTitle /> | ||
| <TitleHarness waveData={{ name: "Wave One", newItemsCount: 0 }} /> | ||
| </TitleProvider> | ||
| ); | ||
|
|
||
| await waitFor(() => { | ||
| expect(screen.getByText("Wave One | Brain")).toBeInTheDocument(); | ||
| }); | ||
| await waitFor(() => { | ||
| expect(document.title).toBe("Wave One | Brain"); | ||
| }); | ||
|
|
||
| mockSearchParams = new URLSearchParams("wave=wave-2"); | ||
| mockActiveWaveId = "wave-2"; | ||
|
|
||
| view.rerender( | ||
| <TitleProvider> | ||
| <DynamicHeadTitle /> | ||
| <TitleHarness waveData={null} /> | ||
| </TitleProvider> | ||
| ); | ||
|
|
||
| await waitFor(() => { | ||
| expect(screen.getByText("Messages | Brain")).toBeInTheDocument(); | ||
| }); | ||
| await waitFor(() => { | ||
| expect(document.title).toBe("Messages | Brain"); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.