Skip to content

Commit

Permalink
chore: add tests for the composable ActionStart
Browse files Browse the repository at this point in the history
  • Loading branch information
Samaritan1011001 committed Oct 24, 2024
1 parent f654b8a commit 247580b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { ActionStart } from '../ActionStart';
import { CLASS_BASE } from '../../views/constants';

describe('ActionStart', () => {
it('renders a button element', () => {
render(<ActionStart />);
const button = screen.getByRole('button');
expect(button).toBeInTheDocument();
});

it('renders a button with the expected className', () => {
render(<ActionStart />);
const button = screen.getByRole('button');
expect(button).toHaveClass(`${CLASS_BASE}__action-start`);
});

it('renders a button with the expected text', () => {
render(<ActionStart label="Start" />);
const button = screen.getByRole('button');
expect(button).toHaveTextContent('Start');
});

it('renders a button with the expected disabled state', () => {
render(<ActionStart isDisabled />);
const button = screen.getByRole('button');
expect(button).toBeDisabled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ describe('useActionStart', () => {
onActionStart: jest.fn(),
};

// Create a spy on the useControlsContext function
const useControlsContextSpy = jest.spyOn(
controlsContextModule,
'useControlsContext'
Expand Down

0 comments on commit 247580b

Please sign in to comment.