Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
f2ef1e7
wip
ragnep Aug 27, 2025
61e990a
Merge branch 'main' into new-desktop-layout
ragnep Aug 27, 2025
85ff25c
wip
ragnep Aug 27, 2025
138d8bf
npm i
ragnep Aug 28, 2025
feba0ee
Merge branch 'main' into new-desktop-layout
ragnep Aug 28, 2025
384e336
wip
ragnep Aug 28, 2025
c68d8d7
Merge branch 'main' into new-desktop-layout
ragnep Sep 1, 2025
0c85c2c
wip
ragnep Sep 1, 2025
9fb660d
Merge branch 'main' into new-desktop-layout
ragnep Sep 2, 2025
1014c67
wip
ragnep Sep 2, 2025
389ab86
Merge branch 'main' into new-desktop-layout
ragnep Sep 2, 2025
31d083f
wip
ragnep Sep 2, 2025
a4624ed
wip
ragnep Sep 4, 2025
478928e
wip
ragnep Sep 4, 2025
0e7040b
wip
ragnep Sep 4, 2025
c2fb0e0
wip
ragnep Sep 4, 2025
f65ec8b
Merge branch 'main' into new-desktop-layout
ragnep Sep 5, 2025
7b5bb23
wip
ragnep Sep 8, 2025
b48812a
wip
ragnep Sep 8, 2025
f5948ee
wip
ragnep Sep 9, 2025
5cc16fa
wip
ragnep Sep 9, 2025
0250417
wip
ragnep Sep 9, 2025
c0caa7e
wip
ragnep Sep 10, 2025
10262d8
wip
ragnep Sep 10, 2025
13a2a2a
wip
ragnep Sep 10, 2025
8d6ddbe
wip
ragnep Sep 11, 2025
4d1312e
wip
ragnep Sep 11, 2025
dd9cb0a
wip
ragnep Sep 11, 2025
02885f9
wip
ragnep Sep 11, 2025
8ad9239
wip
ragnep Sep 11, 2025
3ae5bc2
wip
ragnep Sep 11, 2025
dd38780
wip
ragnep Sep 12, 2025
a72a52e
wip
ragnep Sep 15, 2025
7baac29
wip
ragnep Sep 15, 2025
260f9d5
wip
ragnep Sep 15, 2025
51ff03b
Merge branch 'main' into new-desktop-layout
ragnep Sep 15, 2025
2173911
wip
ragnep Sep 15, 2025
95431eb
wip
ragnep Sep 16, 2025
d2ae494
wip
ragnep Sep 16, 2025
6488833
wip
ragnep Sep 16, 2025
f47f2b6
wip
ragnep Sep 16, 2025
43d33ac
wip
ragnep Sep 16, 2025
54e4b73
wip
ragnep Sep 16, 2025
f0daf44
wip
ragnep Sep 16, 2025
8e6ab15
wip
ragnep Sep 16, 2025
17755c5
Merge branch 'main' into new-desktop-layout
ragnep Sep 16, 2025
8325177
wip
ragnep Sep 17, 2025
a560541
merged main and solved conflicts
ragnep Sep 17, 2025
291e791
wip
ragnep Sep 17, 2025
de23694
wip
ragnep Sep 17, 2025
672ab73
wip
ragnep Sep 18, 2025
eeec44f
Merge branch 'main' into new-desktop-layout
ragnep Sep 18, 2025
454b2c1
wip
ragnep Sep 18, 2025
67714be
Merge branch 'main' into new-desktop-layout
ragnep Sep 18, 2025
c118fcf
wip
ragnep Sep 19, 2025
1f84670
wip
ragnep Sep 22, 2025
9774afe
wip
ragnep Sep 22, 2025
77cacbe
wip
ragnep Sep 22, 2025
7eabdd6
Merge branch 'main' into new-desktop-layout
ragnep Sep 22, 2025
1f8ac75
wip
ragnep Sep 22, 2025
3a2c56d
Merge branch 'main' into new-desktop-layout
ragnep Sep 23, 2025
e12f971
wip
ragnep Sep 23, 2025
8081033
Merge branch 'main' into new-desktop-layout
ragnep Sep 23, 2025
950bb10
wip
ragnep Sep 25, 2025
85c3b8e
Merge branch 'main' into new-desktop-layout
ragnep Sep 25, 2025
42c67bd
wip
ragnep Sep 25, 2025
aaf9f97
Merge branch 'main' into new-desktop-layout
ragnep Sep 25, 2025
7d3ee20
wip
ragnep Sep 25, 2025
2b60b6c
solved conflicts
ragnep Sep 26, 2025
fbceb12
wip
ragnep Sep 26, 2025
d9ca025
wip
ragnep Sep 26, 2025
bf6b63e
Merge branch 'main' into new-desktop-layout
ragnep Sep 29, 2025
14c8877
wip
ragnep Sep 29, 2025
4abfbf1
wip
ragnep Oct 1, 2025
367c7d9
wip
ragnep Oct 1, 2025
dc841b5
wip
ragnep Oct 1, 2025
73fc7db
wip
ragnep Oct 2, 2025
944fb32
Merge branch 'main' into new-desktop-layout
ragnep Oct 2, 2025
826a699
wip
ragnep Oct 2, 2025
a9ea668
wip
ragnep Oct 2, 2025
ad6cc5d
wip
ragnep Oct 2, 2025
5f3b4fb
merged main and solved conflicts
ragnep Oct 6, 2025
f96b4ff
wip
ragnep Oct 7, 2025
6c411d5
wip
ragnep Oct 7, 2025
c4d966a
wip
ragnep Oct 7, 2025
8c5319b
wip
ragnep Oct 8, 2025
42a4b28
wip
ragnep Oct 8, 2025
70ed89d
wip
ragnep Oct 8, 2025
845ee64
wip
ragnep Oct 8, 2025
a55ac70
Merge branch 'main' into new-desktop-layout
ragnep Oct 8, 2025
e50f167
wip
ragnep Oct 8, 2025
6f93610
Merge branch 'main' into new-desktop-layout
ragnep Oct 8, 2025
4075768
Merge branch 'main' into new-desktop-layout
ragnep Oct 9, 2025
14d7a2d
wip
ragnep Oct 9, 2025
ae412d3
merged main
ragnep Oct 9, 2025
7a4c713
wip
ragnep Oct 9, 2025
2e3caf6
wip
ragnep Oct 9, 2025
bb4bc3c
wip
ragnep Oct 9, 2025
7abcd37
wip
ragnep Oct 9, 2025
a7d7e9d
wip
ragnep Oct 10, 2025
ae05eb4
wip
ragnep Oct 10, 2025
a939e71
wip
ragnep Oct 10, 2025
2709fea
wip
ragnep Oct 10, 2025
c10ccc4
wip
ragnep Oct 10, 2025
5a21fb0
wip
ragnep Oct 10, 2025
39d2688
Merge branch 'main' into new-desktop-layout
ragnep Oct 10, 2025
f69b1a2
wip
ragnep Oct 10, 2025
42e5b44
wip
ragnep Oct 10, 2025
e78a61d
wip
ragnep Oct 10, 2025
b88cc05
Merge branch 'main' into new-desktop-layout
ragnep Oct 13, 2025
aaffbf9
wip
ragnep Oct 13, 2025
c8a15cf
wip
ragnep Oct 13, 2025
f43f33a
Merge branch 'main' into new-desktop-layout
ragnep Oct 13, 2025
8776066
wip
ragnep Oct 13, 2025
4fb0204
wip
ragnep Oct 13, 2025
a777dbd
wip
ragnep Oct 13, 2025
17e531b
wip
ragnep Oct 13, 2025
b11457d
wip
ragnep Oct 13, 2025
7359585
wip
ragnep Oct 13, 2025
fc982f9
wip
ragnep Oct 13, 2025
5697789
layout max width
ragnep Oct 13, 2025
3cc0d78
wip
ragnep Oct 14, 2025
3098bf7
Merge branch 'main' into new-desktop-layout
ragnep Oct 14, 2025
2b5d5d0
wip
ragnep Oct 14, 2025
86c2e09
Merge branch 'main' into new-desktop-layout
ragnep Oct 14, 2025
7dbe433
wip
ragnep Oct 15, 2025
0bdaec4
wip
ragnep Oct 15, 2025
d95bff3
wip
ragnep Oct 15, 2025
72bfe59
Merge branch 'main' into new-desktop-layout
ragnep Oct 16, 2025
0a996fe
wip
ragnep Oct 16, 2025
f9865e4
wip
ragnep Oct 16, 2025
4473b63
Merge branch 'main' into new-desktop-layout
ragnep Oct 17, 2025
360f6c8
wip
ragnep Oct 17, 2025
a9ef21e
wip
ragnep Oct 17, 2025
c8f816d
wip
ragnep Oct 20, 2025
331fadf
wip
ragnep Oct 20, 2025
303f34f
wip
ragnep Oct 20, 2025
353b44e
wip
ragnep Oct 20, 2025
e75509f
wip
ragnep Oct 20, 2025
dcb0a96
wip
ragnep Oct 20, 2025
421ba96
wip
ragnep Oct 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
67 changes: 64 additions & 3 deletions FooterWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,77 @@
"use client";

import Footer from "@/components/footer/Footer";
import { SIDEBAR_WIDTHS } from "@/constants/sidebar";
import { usePathname } from "next/navigation";
import { useEffect, useState } from "react";
import useDeviceInfo from "./hooks/useDeviceInfo";
import Footer from "@/components/footer/Footer";
import { useSidebarController } from "./hooks/useSidebarController";

export default function FooterWrapper() {
const { isApp } = useDeviceInfo();
const pathname = usePathname();
const [homeActiveTab, setHomeActiveTab] = useState<string>("latest");
const { sidebarWidth, isMobile, isNarrow } = useSidebarController();
useEffect(() => {
const win = (globalThis as typeof globalThis & { window?: Window }).window;
if (win === undefined) {
return;
}

const determineInitialTab = () => {
try {
const params = new URLSearchParams(win.location?.search ?? "");
const tabFromQuery = params.get("tab");
const savedTab = win.localStorage.getItem("home.activeTab");
const resolvedTab = tabFromQuery ?? savedTab;
if (resolvedTab) {
setHomeActiveTab(resolvedTab);
}
} catch (error) {
console.warn("Failed to determine active home tab", error);
}
};

determineInitialTab();

const handleTabChange = (event: CustomEvent<{ tab?: string }>) => {
if (event.detail?.tab) {
setHomeActiveTab(event.detail.tab);
}
};

win.addEventListener("homeTabChange", handleTabChange as EventListener);

return () => {
win.removeEventListener("homeTabChange", handleTabChange as EventListener);
};
}, []);

const homeFeedTabActive = pathname === "/" && homeActiveTab === "feed";
const myFeedRoutes = ["/my-feed", "/feed"];

const hideFooter =
isApp ||
["/waves", "/my-stream", "/open-mobile"].some((path) =>
homeFeedTabActive ||
myFeedRoutes.some((path) => pathname?.startsWith(path)) ||
["/waves", "/messages", "/notifications", "/open-mobile"].some((path) =>
pathname?.startsWith(path)
);
return hideFooter ? null : <Footer />;

if (hideFooter) return null;

// App mode or small-screen web: no left-rail spacing
if (isApp || isMobile) return <Footer />;

Comment thread
ragnep marked this conversation as resolved.
// Desktop WebLayout: match main content's sidebar spacing
const sidebarSpacing = isNarrow ? SIDEBAR_WIDTHS.COLLAPSED : sidebarWidth;

return (
<div
className="tw-w-full tw-max-w-[82.75rem] tw-mx-auto"
style={{ paddingLeft: sidebarSpacing }}
>
<Footer />
</div>
);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
1 change: 0 additions & 1 deletion __mocks__/nextFontMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const createFontMock = () => ({
module.exports = {
Inter: createFontMock,
Roboto: createFontMock,
Poppins: createFontMock,
Open_Sans: createFontMock,
Lato: createFontMock,
Montserrat: createFontMock,
Expand Down
2 changes: 1 addition & 1 deletion __tests__/app/waveRedirect.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ jest.mock("next/navigation", () => ({ redirect: jest.fn() }));
describe("Wave redirect page", () => {
it("calls next/navigation redirect with wave param", async () => {
await WaveRedirect({ params: { wave: "test-wave-123" } } as any);
expect(redirect).toHaveBeenCalledWith("/my-stream?wave=test-wave-123");
expect(redirect).toHaveBeenCalledWith("/waves?wave=test-wave-123");
});
});
3 changes: 0 additions & 3 deletions __tests__/components/DistributionPlanToolWrapper.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import { useSeizeConnectContext } from "@/components/auth/SeizeConnectContext";
import DistributionPlanToolWrapper from "@/components/distribution-plan-tool/wrapper/DistributionPlanToolWrapper";
import { render } from "@testing-library/react";

jest.mock("next/font/google", () => ({
Poppins: () => ({ className: "poppins" }),
}));
jest.mock("@/components/auth/SeizeConnectContext");

// Mock TitleContext
Expand Down
20 changes: 0 additions & 20 deletions __tests__/components/TimeCountdown.test.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion __tests__/components/about/AboutApply.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('AboutApply', () => {
});
expect(link).toHaveAttribute(
'href',
'https://6529.io/my-stream?wave=0ecb95d0-d8f2-48e8-8137-bfa71ee8593c'
'https://6529.io/waves?wave=0ecb95d0-d8f2-48e8-8137-bfa71ee8593c'
);
expect(link).toHaveAttribute('target', '_blank');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ describe('AllowlistToolCommonModalWrapper', () => {
<div>content</div>
</AllowlistToolCommonModalWrapper>
);
const overlay = document.querySelector('.tw-bg-opacity-75') as HTMLElement;
fireEvent.mouseDown(overlay);
const overlay = document.querySelector('.tw-bg-opacity-50');
expect(overlay).not.toBeNull();
fireEvent.mouseDown(overlay as Element);
expect(handleClose).toHaveBeenCalledTimes(1);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import { BlockPickerTimeWindow } from "@/app/tools/block-finder/page.client";
import BlockPickerTimeWindowSelectList from "@/components/block-picker/BlockPickerTimeWindowSelectList";
import { fireEvent, render, screen } from "@testing-library/react";

jest.mock("next/font/google", () => ({
Poppins: () => ({ className: "poppins" }),
}));

describe("BlockPickerTimeWindowSelectList", () => {
const options = [
{ title: "One", value: BlockPickerTimeWindow.ONE_MINUTE },
Expand Down
31 changes: 17 additions & 14 deletions __tests__/components/brain/Brain.test.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
import { render, screen } from '@testing-library/react';
let useBreakpointMock = jest.fn();

jest.mock('react-use', () => ({
createBreakpoint: () => useBreakpointMock,
}));
import Brain from '@/components/brain/Brain';

jest.mock('@/components/brain/BrainMobile', () => ({
__esModule: true,
default: ({ children }: any) => <div data-testid="mobile">{children}</div>,
default: ({ children }: any) => <div data-testid='mobile'>{children}</div>,
}));

jest.mock('@/components/brain/BrainDesktop', () => ({
__esModule: true,
default: ({ children }: any) => <div data-testid="desktop">{children}</div>,
default: ({ children }: any) => <div data-testid='desktop'>{children}</div>,
}));

import Brain from '@/components/brain/Brain';
jest.mock('@/hooks/useDeviceInfo', () => ({
__esModule: true,
default: jest.fn(),
}));

const useDeviceInfo = jest.requireMock('@/hooks/useDeviceInfo').default as jest.Mock;

describe('Brain', () => {
beforeEach(() => {
useBreakpointMock.mockReset();
useDeviceInfo.mockReset();
});

it('renders mobile version when breakpoint is S', () => {
useBreakpointMock.mockReturnValue('S');
it('renders mobile version when running inside the app', () => {
useDeviceInfo.mockReturnValue({ isApp: true });
render(<Brain>child</Brain>);

expect(screen.getByTestId('mobile')).toBeInTheDocument();
expect(screen.getByText('child')).toBeInTheDocument();
expect(screen.queryByTestId('desktop')).not.toBeInTheDocument();
expect(screen.queryByTestId('desktop')).toBeNull();
});

it('renders desktop version otherwise', () => {
useBreakpointMock.mockReturnValue('LG');
useDeviceInfo.mockReturnValue({ isApp: false });
render(<Brain>desk</Brain>);

expect(screen.getByTestId('desktop')).toBeInTheDocument();
expect(screen.getByText('desk')).toBeInTheDocument();
expect(screen.queryByTestId('mobile')).not.toBeInTheDocument();
expect(screen.queryByTestId('mobile')).toBeNull();
});
});
27 changes: 22 additions & 5 deletions __tests__/components/brain/BrainDesktop.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@ jest.mock('@/components/brain/BrainDesktopDrop', () => jest.fn(({ onClose }) =>
jest.mock('@/components/brain/ContentTabContext', () => ({ ContentTabProvider: ({children}:any) => <div>{children}</div> }));
jest.mock('@/components/brain/my-stream/layout/LayoutContext', () => ({ useLayout: () => ({ contentContainerStyle:{} }) }));
jest.mock('@tanstack/react-query', () => ({ useQuery: jest.fn(), keepPreviousData:{} }));
jest.mock('@/hooks/useSidebarState', () => ({
__esModule: true,
useSidebarState: jest.fn()
}));

import BrainDesktop from '@/components/brain/BrainDesktop';
import { useSidebarState } from '@/hooks/useSidebarState';

const mockedRouter = useRouter as jest.Mock;
const mockedUseSearchParams = useSearchParams as jest.Mock;
const mockedUsePathname = usePathname as jest.Mock;
const mockedUseQuery = useQuery as jest.Mock;
const mockedDrop = require('@/components/brain/BrainDesktopDrop');
const mockedUseSidebarState = useSidebarState as jest.Mock;

function setup(query:any){
function setup(query:any, options?: { sidebarOpen?: boolean }) {
const push = jest.fn();
const searchParams = {
get: jest.fn((key:string) => query[key] || null),
Expand All @@ -41,30 +47,41 @@ function setup(query:any){
mockedUseQuery.mockReturnValue({ data: query.drop ? { id: query.drop } : null });
rightMock.mockClear();
(mockedDrop as jest.Mock).mockClear();
mockedUseSidebarState.mockReturnValue({
isRightSidebarOpen: options?.sidebarOpen ?? true,
closeRightSidebar: jest.fn(),
openRightSidebar: jest.fn(),
toggleRightSidebar: jest.fn()
});
return { push, searchParams, ...render(<BrainDesktop>child</BrainDesktop>) };
}

describe('BrainDesktop', () => {
it('shows right sidebar when wave present', () => {
setup({ wave:'1' });
setup({ wave:'1' }, { sidebarOpen: true });
expect(screen.getByTestId('right')).toBeInTheDocument();
expect(screen.queryByTestId('drop')).toBeNull();
});

it('does not show right sidebar when closed', () => {
setup({ wave:'1' }, { sidebarOpen: false });
expect(screen.queryByTestId('right')).toBeNull();
});

it('shows drop overlay when drop param set', () => {
setup({ wave:'1', drop:'d1' });
setup({ wave:'1', drop:'d1' }, { sidebarOpen: true });
expect(screen.getByTestId('drop')).toBeInTheDocument();
expect(screen.queryByTestId('right')).toBeNull();
});

it('removes drop param on close', () => {
const { push } = setup({ wave:'1', drop:'d1' });
const { push } = setup({ wave:'1', drop:'d1' }, { sidebarOpen: true });
screen.getByTestId('drop').click();
expect(push).toHaveBeenCalledWith('/brain?wave=1', { scroll: false });
});

it('handles drop click from sidebar', () => {
const { push } = setup({ wave:'1' });
const { push } = setup({ wave:'1' }, { sidebarOpen: true });
const call = (rightMock.mock.calls[0] as any)[0];
call.onDropClick({ id:'new' });
expect(push).toHaveBeenCalledWith('/brain?wave=1&drop=new', { scroll: false });
Expand Down
2 changes: 1 addition & 1 deletion __tests__/components/brain/BrainMobile.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('BrainMobile', () => {
});

it('shows notifications view when path matches', async () => {
mockPathname = '/my-stream/notifications';
mockPathname = '/notifications';
render(<BrainMobile>child</BrainMobile>);
await waitFor(() => {
expect(screen.getByTestId('notifications')).toBeInTheDocument();
Expand Down
2 changes: 1 addition & 1 deletion __tests__/components/brain/NotificationsWrapper.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ describe('NotificationsWrapper', () => {
);
screen.getByTestId('items').click();
expect(setActive).toHaveBeenCalledTimes(2);
expect(push).toHaveBeenCalledWith('/my-stream?wave=w&serialNo=1/');
expect(push).toHaveBeenCalledWith('/waves?wave=w&serialNo=1/');
});
});
5 changes: 5 additions & 0 deletions __tests__/components/brain/content/BrainContent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ jest.mock('react-use', () => ({
createBreakpoint: () => () => bpValue,
}));

jest.mock('@/hooks/useDeviceInfo', () => ({
__esModule: true,
default: jest.fn(() => ({ isApp: true })),
}));

jest.mock('@/components/brain/my-stream/layout/LayoutContext', () => ({
useLayout: () => ({ registerRef }),
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ jest.mock('@/hooks/usePrefetchWaveData', () => ({
usePrefetchWaveData: () => prefetch,
}));

jest.mock('@/hooks/useDeviceInfo', () => ({
__esModule: true,
default: () => ({ isApp: false }),
}));

const registerWave = jest.fn();
jest.mock('@/contexts/wave/MyStreamContext', () => ({
useMyStream: () => ({ registerWave }),
Expand Down Expand Up @@ -82,7 +87,7 @@ describe('BrainContentPinnedWave', () => {
const { container } = renderComponent();

expect(screen.getAllByText('Wave 1').length).toBeGreaterThan(0);
expect(screen.getByRole('link')).toHaveAttribute('href', '/my-stream?wave=1');
expect(screen.getByRole('link')).toHaveAttribute('href', '/waves?wave=1');

await user.hover(container.firstChild as HTMLElement);
expect(onMouseEnter).toHaveBeenCalledWith('1');
Expand All @@ -94,15 +99,15 @@ describe('BrainContentPinnedWave', () => {

await user.click(screen.getByRole('link'));
expect(onMouseLeave).toHaveBeenCalled();
expect(push).toHaveBeenCalledWith('/my-stream?wave=1');
expect(push).toHaveBeenCalledWith('/waves?wave=1');
});

it('uses /my-stream when viewing active wave and skips prefetch', async () => {
it('uses waves route when viewing active wave and skips prefetch', async () => {
searchParams.set('wave', '1');
const user = userEvent.setup();
const { container } = renderComponent();

expect(screen.getByRole('link')).toHaveAttribute('href', '/my-stream');
expect(screen.getByRole('link')).toHaveAttribute('href', '/waves');

await user.hover(container.firstChild as HTMLElement);
expect(onMouseEnter).toHaveBeenCalledWith('1');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ jest.mock('@/components/brain/content/BrainContentPinnedWave', () => ({
),
}));

jest.mock('@/contexts/wave/MyStreamContext', () => ({
useMyStream: jest.fn(),
}));

import BrainContentPinnedWaves from '@/components/brain/content/BrainContentPinnedWaves';
import { useMyStream } from '@/contexts/wave/MyStreamContext';

const mockUseMyStream = useMyStream as jest.Mock;

beforeAll(() => {
(window as any).matchMedia = (window as any).matchMedia || (() => ({ matches: false, addListener: jest.fn(), removeListener: jest.fn() }));
Expand All @@ -40,6 +47,7 @@ describe('BrainContentPinnedWaves', () => {
replace.mockClear();
mockPinnedIds = [];
searchParams.delete('wave');
mockUseMyStream.mockReturnValue({ directMessages: { list: [] } });
});

it('returns null when no pinned waves', () => {
Expand All @@ -59,6 +67,6 @@ describe('BrainContentPinnedWaves', () => {
expect(wave2).toBeInTheDocument();
await user.click(wave1);
expect(removeId).toHaveBeenCalledWith('1');
expect(replace).toHaveBeenCalledWith('/my-stream');
expect(replace).toHaveBeenCalledWith('/waves');
Comment thread
ragnep marked this conversation as resolved.
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ describe('DirectMessagesList', () => {
});

it('shows connect wallet placeholder when not authenticated', () => {
const { container } = renderWithAuth(null);
expect(container.querySelector('#my-stream-connect')).toBeInTheDocument();
renderWithAuth(null);
expect(screen.getByTestId('connect')).toBeInTheDocument();
expect(screen.getByTestId('connect')).toBeInTheDocument();
Comment thread
ragnep marked this conversation as resolved.
});
Comment thread
ragnep marked this conversation as resolved.

Expand Down
Loading
Loading