-
Notifications
You must be signed in to change notification settings - Fork 4
Vote for identity wave #2171
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
Vote for identity wave #2171
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
fcea3eb
wip
simo6529 98dcf0a
wip
simo6529 6a0138e
wip
simo6529 dc0c8d9
wip
simo6529 9d93222
wip
simo6529 2a627b2
wip
simo6529 5024c83
wip
simo6529 86e38be
wip
simo6529 e20645b
wip
simo6529 2b4c0b1
wip
simo6529 9372447
wip
simo6529 2a8792c
wip
simo6529 dcd01ac
wip
simo6529 6897539
wip
simo6529 f7e5baf
Merge branch 'main' into vote-for-identity-wave
simo6529 21fe958
wip
simo6529 a2c4def
Merge branch 'main' into vote-for-identity-wave
ragnep bf46b09
wip
ragnep 544a603
wip
ragnep cbb5859
Merge branch 'main' into vote-for-identity-wave
ragnep 7777f83
wip
ragnep 40284e0
wip
ragnep 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
This file was deleted.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| - generic [active]: | ||
| - button "Open Next.js Dev Tools" [ref=e6] [cursor=pointer]: | ||
| - generic [ref=e9]: | ||
| - text: Compiling | ||
| - generic [ref=e10]: | ||
| - generic [ref=e11]: . | ||
| - generic [ref=e12]: . | ||
| - generic [ref=e13]: . | ||
| - alert [ref=e14] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,4 @@ | ||
| - generic [active]: | ||
| - button "Open Next.js Dev Tools" [ref=e6] [cursor=pointer]: | ||
| - img [ref=e7] | ||
| - alert [ref=e10] |
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,4 @@ | ||
| - generic [active]: | ||
| - button "Open Next.js Dev Tools" [ref=e6] [cursor=pointer]: | ||
| - img [ref=e7] | ||
| - alert [ref=e10] |
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
60 changes: 60 additions & 0 deletions
60
__tests__/components/brain/right-sidebar/BrainRightSidebarContent.test.tsx
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,60 @@ | ||
| import { render, screen } from "@testing-library/react"; | ||
| import BrainRightSidebarContent from "@/components/brain/right-sidebar/BrainRightSidebarContent"; | ||
|
|
||
| const captured: string[] = []; | ||
|
|
||
| jest.mock( | ||
| "@/components/waves/leaderboard/sidebar/WaveLeaderboardRightSidebarBoostedDrops", | ||
| () => ({ | ||
| __esModule: true, | ||
| WaveLeaderboardRightSidebarBoostedDrops: (props: any) => { | ||
| captured.push(`boosted:${props.wave.id}`); | ||
| return <div data-testid="boosted-drops" />; | ||
| }, | ||
| }) | ||
| ); | ||
|
|
||
| jest.mock("@/components/waves/specs/WaveSpecs", () => ({ | ||
| __esModule: true, | ||
| default: (props: any) => { | ||
| captured.push(`specs:${props.wave.id}`); | ||
| return <div data-testid="wave-specs" />; | ||
| }, | ||
| })); | ||
|
|
||
| jest.mock("@/components/waves/specs/WaveIdentitySubmissionSpecs", () => ({ | ||
| __esModule: true, | ||
| default: (props: any) => { | ||
| captured.push(`identity:${props.wave.id}`); | ||
| return <div data-testid="identity-submission-specs" />; | ||
| }, | ||
| })); | ||
|
|
||
| jest.mock("@/components/waves/groups/WaveGroups", () => ({ | ||
| __esModule: true, | ||
| default: (props: any) => { | ||
| captured.push(`groups:${props.wave.id}`); | ||
| return <div data-testid="wave-groups" />; | ||
| }, | ||
| })); | ||
|
|
||
| describe("BrainRightSidebarContent", () => { | ||
| beforeEach(() => { | ||
| captured.length = 0; | ||
| }); | ||
|
|
||
| it("renders sidebar sections in the expected order", () => { | ||
| render(<BrainRightSidebarContent wave={{ id: "wave-1" } as any} />); | ||
|
|
||
| expect(screen.getByTestId("boosted-drops")).toBeInTheDocument(); | ||
| expect(screen.getByTestId("wave-specs")).toBeInTheDocument(); | ||
| expect(screen.getByTestId("identity-submission-specs")).toBeInTheDocument(); | ||
| expect(screen.getByTestId("wave-groups")).toBeInTheDocument(); | ||
| expect(captured).toEqual([ | ||
| "boosted:wave-1", | ||
| "specs:wave-1", | ||
| "identity:wave-1", | ||
| "groups:wave-1", | ||
| ]); | ||
| }); | ||
| }); |
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 |
|---|---|---|
| @@ -1,32 +1,72 @@ | ||
| import React from 'react'; | ||
| import { render, screen, fireEvent } from '@testing-library/react'; | ||
| import MemeWinnerDrop from '@/components/memes/drops/MemeWinnerDrop'; | ||
| import React from "react"; | ||
| import { render, screen, fireEvent } from "@testing-library/react"; | ||
| import MemeWinnerDrop from "@/components/memes/drops/MemeWinnerDrop"; | ||
|
|
||
| jest.mock('@/hooks/isMobileDevice', () => jest.fn(() => false)); | ||
| jest.mock('@/components/waves/drops/WaveDropActions', () => (props: any) => ( | ||
| <button data-testid='reply' onClick={() => props.onReply({})} /> | ||
| jest.mock("@/hooks/isMobileDevice", () => jest.fn(() => false)); | ||
| jest.mock("@/components/waves/drops/WaveDropActions", () => (props: any) => ( | ||
| <button data-testid="reply" onClick={() => props.onReply({})} /> | ||
| )); | ||
| jest.mock('@/components/memes/drops/MemeWinnerHeader', () => (props: any) => <div>{props.title}</div>); | ||
| jest.mock('@/components/memes/drops/MemeWinnerDescription', () => (props: any) => <p>{props.description}</p>); | ||
| jest.mock('@/components/memes/drops/MemeWinnerArtistInfo', () => () => <div data-testid='artist'/>); | ||
| jest.mock('@/components/memes/drops/MemeDropTraits', () => () => <div data-testid='traits'/>); | ||
| jest.mock('@/components/waves/drops/DropMobileMenuHandler', () => (props: any) => <div>{props.children}</div>); | ||
| jest.mock('@/components/drops/view/item/content/media/DropListItemContentMedia', () => (props: any) => <img data-testid='media' src={props.media_url}/>); | ||
| jest.mock("@/components/memes/drops/MemeWinnerHeader", () => (props: any) => ( | ||
| <div>{props.title}</div> | ||
| )); | ||
| jest.mock( | ||
| "@/components/memes/drops/MemeWinnerDescription", | ||
| () => (props: any) => <p>{props.description}</p> | ||
| ); | ||
| jest.mock("@/components/memes/drops/MemeWinnerArtistInfo", () => () => ( | ||
| <div data-testid="artist" /> | ||
| )); | ||
| jest.mock("@/components/memes/drops/MemeDropTraits", () => () => ( | ||
| <div data-testid="traits" /> | ||
| )); | ||
| jest.mock("@/components/waves/winners/identity/WaveWinnerIdentity", () => ({ | ||
| WaveWinnerIdentity: () => <div data-testid="identity" />, | ||
| })); | ||
| jest.mock( | ||
| "@/components/waves/drops/DropMobileMenuHandler", | ||
| () => (props: any) => <div>{props.children}</div> | ||
| ); | ||
| jest.mock( | ||
| "@/components/drops/view/item/content/media/DropListItemContentMedia", | ||
| () => (props: any) => <img data-testid="media" src={props.media_url} /> | ||
| ); | ||
|
|
||
| jest.mock('@/components/waves/drops/DropContext', () => ({ useDropContext: () => ({ location: 'WAVE' }) })); | ||
| jest.mock("@/components/waves/drops/DropContext", () => ({ | ||
| useDropContext: () => ({ location: "WAVE" }), | ||
| })); | ||
|
|
||
| const drop: any = { parts: [{ part_id:1, media:[{ url:'u', mime_type:'image/png'}] }], metadata: [] , author:{}, wave:{} }; | ||
| const drop: any = { | ||
| parts: [{ part_id: 1, media: [{ url: "u", mime_type: "image/png" }] }], | ||
| metadata: [], | ||
| author: {}, | ||
| wave: {}, | ||
| }; | ||
|
|
||
| test('renders actions on desktop', () => { | ||
| test("renders actions on desktop", () => { | ||
| const onReply = jest.fn(); | ||
| render(<MemeWinnerDrop drop={drop} showReplyAndQuote onReply={onReply} onQuote={jest.fn()} />); | ||
| fireEvent.click(screen.getByTestId('reply')); | ||
| render( | ||
| <MemeWinnerDrop | ||
| drop={drop} | ||
| showReplyAndQuote | ||
| onReply={onReply} | ||
| onQuote={jest.fn()} | ||
| /> | ||
| ); | ||
| expect(screen.getByTestId("identity")).toBeInTheDocument(); | ||
| fireEvent.click(screen.getByTestId("reply")); | ||
| expect(onReply).toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| test('hides actions when mobile', () => { | ||
| const useMobile = require('@/hooks/isMobileDevice'); | ||
| test("hides actions when mobile", () => { | ||
| const useMobile = require("@/hooks/isMobileDevice"); | ||
| (useMobile as jest.Mock).mockReturnValue(true); | ||
| const { queryByTestId } = render(<MemeWinnerDrop drop={drop} showReplyAndQuote onReply={jest.fn()} onQuote={jest.fn()} />); | ||
| expect(queryByTestId('reply')).toBeNull(); | ||
| const { queryByTestId } = render( | ||
| <MemeWinnerDrop | ||
| drop={drop} | ||
| showReplyAndQuote | ||
| onReply={jest.fn()} | ||
| onQuote={jest.fn()} | ||
| /> | ||
| ); | ||
|
simo6529 marked this conversation as resolved.
|
||
| expect(queryByTestId("reply")).toBeNull(); | ||
| }); | ||
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
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.