stakwork / sphinx-nav-fiber

12 stars 45 forks source link

[Component Tests] AddItemModal #890

Open tomsmith8 opened 7 months ago

tomsmith8 commented 7 months ago

Task

Write unit tests for src/components/AddItemModal/index.tsx

Boiler plate example:

import { render, screen, fireEvent } from '@testing-library/react';
import { AddItemModal } from './AddItemModal';
import { ModalProvider } from '~/contexts/ModalContext';
import { UserStoreProvider } from '~/contexts/UserStoreContext';

describe('AddItemModal', () => {
  const renderComponent = () => render(
    <ModalProvider>
      <UserStoreProvider>
        <AddItemModal />
      </UserStoreProvider>
    </ModalProvider>
  );

  it('renders the modal and navigates through steps', async () => {
    renderComponent();

    // Check initial step is rendered
    expect(screen.getByText(/select node type/i)).toBeInTheDocument();

    // Mock user selecting a node type and clicking "Next"
    fireEvent.change(screen.getByRole('combobox'), { target: { value: 'Image' } });
    fireEvent.click(screen.getByText(/next/i));

    // Verify navigation to the next step
    expect(screen.getByText(/enter source link/i)).toBeInTheDocument();

    // Navigate back
    fireEvent.click(screen.getByText(/previous/i));
    expect(screen.getByText(/select node type/i)).toBeInTheDocument();
  });

  // Additional tests here
});

Acceptance Criteria

arimusdev commented 7 months ago

can i take this?

arimusdev commented 7 months ago

@tomsmith8 Sorry, I think I won't be able to complete this task. It's too complicated.

Ekep-Obasi commented 7 months ago

@tomsmith8 Sorry, I think I won't be able to complete this task. It's too complicated.

@arimusdev If you have any particular issues with this issue, I'd love to be of help

tomsmith8 commented 7 months ago

Ok, let's hold off in this bounty for now

hangman32 commented 5 months ago

@tomsmith8 please assign me

chiragDork commented 5 months ago

@tomsmith8 can you please assign

Ekep-Obasi commented 5 months ago

@tomsmith8 i will love to work on this if it is open