stakwork / sphinx-nav-fiber

12 stars 45 forks source link

[Component Tests] Sidebar #912

Closed tomsmith8 closed 6 months ago

tomsmith8 commented 7 months ago

Task

Write unit tests for this file src/components/App/SideBar

Boiler plate example:

import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SideBar } from './SideBar';
import * as AppStoreHooks from '~/stores/useAppStore';

jest.mock('~/stores/useAppStore');

describe('SideBar Component', () => {
  beforeEach(() => {
    AppStoreHooks.useAppStore.mockImplementation(() => [{ sidebarIsOpen: false }, jest.fn()]);
  });

  it('renders the sidebar when sidebarIsOpen is true', () => {
    AppStoreHooks.useAppStore.mockImplementation(() => [{ sidebarIsOpen: true }, jest.fn()]);
    render(<SideBar />);
    expect(screen.getByTestId('sidebar-wrapper')).toBeInTheDocument();
  });

  it('does not render the sidebar when sidebarIsOpen is false', () => {
    render(<SideBar />);
    expect(screen.queryByTestId('sidebar-wrapper')).toBeNull();
  });

  // Additional tests for search functionality, subview handling, etc.
});

Acceptance Criteria

Ekep-Obasi commented 7 months ago

@tomsmith8 Could you please assign ?

tomsmith8 commented 7 months ago

@Ekep-Obasi any update on this one?

Fog3211 commented 7 months ago

@tomsmith8 please assign it to me if Ekep give up it

arimusdev commented 7 months ago

@tomsmith8 assign

Ekep-Obasi commented 7 months ago

@tomsmith, sorry i'd a blocker which is taking me long to figure out You could assign this to anyone

tomsmith8 commented 7 months ago

No problem, I've assigned to you @Fog3211 and increased bounty payout size

takeontom commented 7 months ago

@tomsmith, sorry i'd a blocker which is taking me long to figure out You could assign this to anyone

Wrong Tom Smith 🙂

aliraza556 commented 6 months ago

Hi @Fog3211, Are you working on this issue? or Not

Ekep-Obasi commented 6 months ago

@Fog3211, If you're facing issues with this. Perhaps you could take a look at the test in the SidebarSubView component. If you give up, I'd love to help.

tomsmith8 commented 6 months ago

Keep me posted @Fog3211 if you're having issues or problems let me know or I can reassign

aliraza556 commented 6 months ago

Hi @tomsmith8, If the bounty is available, please assign it to me.

Fog3211 commented 6 months ago

Keep me posted @Fog3211 if you're having issues or problems let me know or I can reassign

@tomsmith8 Sorry about late, It's difficult for me, please assign it to others

jordan-ae commented 6 months ago

@tomsmith8 i can help @Fog3211

aliraza556 commented 6 months ago

Hi @tomsmith8, Assign me

Ekep-Obasi commented 6 months ago

@aliraza556, this issue is overdue Are you working on this or not?

@tomsmith8, I figured out my blocker, if @aliraza556 is facing issues I can get a PR for this today

tomsmith8 commented 6 months ago

I will reassign shortly unless Ali has a PR ready. Thanks @Ekep-Obasi

aliraza556 commented 6 months ago

Ok @tomsmith8, Assign to @Ekep-Obasi

Ekep-Obasi commented 6 months ago

@tomsmith8, react-testing-library is not meant for these kind of use cases in test 6, since it involves scrolling

I'd leave it out