-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
183 additions
and
152 deletions.
There are no files selected for viewing
99 changes: 0 additions & 99 deletions
99
src/components/layout/header/MobileMenu/__tests__/MenuContent.spec.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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 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
File renamed without changes.
This file contains 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 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,3 @@ | ||
import CustomNotifications from './custom-notifications'; | ||
|
||
export default CustomNotifications; |
This file contains 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 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 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 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,3 @@ | ||
import Header from './header'; | ||
|
||
export default Header; |
This file contains 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,3 @@ | ||
import MenuItems from './menu-items'; | ||
|
||
export default MenuItems; |
File renamed without changes.
This file contains 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
2 changes: 1 addition & 1 deletion
2
.../MobileMenu/__tests__/BackButton.spec.tsx → ...obile-menu/__tests__/back-button.spec.tsx
This file contains 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
56 changes: 56 additions & 0 deletions
56
src/components/layout/header/mobile-menu/__tests__/menu-content.spec.tsx
This file contains 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,56 @@ | ||
import { BrowserRouter } from 'react-router-dom'; | ||
import { mockStore, StoreProvider } from '@/hooks/useStore'; | ||
import { mock_ws } from '@/utils/mock'; | ||
import { useDevice } from '@deriv-com/ui'; | ||
import { render, screen } from '@testing-library/react'; | ||
import MenuContent from '../menu-content'; | ||
|
||
jest.mock('@deriv-com/ui', () => ({ | ||
...jest.requireActual('@deriv-com/ui'), | ||
useDevice: jest.fn(() => ({ isDesktop: false })), | ||
})); | ||
|
||
jest.mock('@deriv-com/api-hooks', () => ({ | ||
useAuthData: jest.fn().mockReturnValue({ | ||
isAuthorized: true, | ||
}), | ||
})); | ||
|
||
jest.mock('../../platform-switcher', () => jest.fn(() => <div>Mock Platform Switcher</div>)); | ||
|
||
describe('MenuContent Component', () => { | ||
const mock_store = mockStore(mock_ws as any); | ||
|
||
const wrapper = ({ children }: { children: React.ReactNode }) => ( | ||
<BrowserRouter> | ||
<StoreProvider mockStore={mock_store}>{children}</StoreProvider> | ||
</BrowserRouter> | ||
); | ||
|
||
beforeEach(() => { | ||
Object.defineProperty(window, 'matchMedia', { | ||
value: jest.fn(), | ||
writable: true, | ||
}); | ||
}); | ||
|
||
it('renders PlatformSwitcher and MenuItem components correctly', () => { | ||
render(<MenuContent />, { wrapper }); | ||
expect(screen.getByText(/Mock Platform Switcher/)).toBeInTheDocument(); | ||
expect(screen.getByText(/Trader's Hub/)).toBeInTheDocument(); | ||
expect(screen.getByText(/Deriv.com/)).toBeInTheDocument(); | ||
}); | ||
|
||
it('adjusts text size for mobile devices', () => { | ||
render(<MenuContent />, { wrapper }); | ||
const text = screen.getByText(/Trader's Hub/); | ||
expect(text).toHaveClass('derivs-text__size--md'); | ||
}); | ||
|
||
it('adjusts text size for desktop devices', () => { | ||
(useDevice as jest.Mock).mockReturnValue({ isDesktop: true }); | ||
render(<MenuContent />, { wrapper }); | ||
const text = screen.getByText(/Trader's Hub/); | ||
expect(text).toHaveClass('derivs-text__size--sm'); | ||
}); | ||
}); |
Oops, something went wrong.