Files
motovaultpro/frontend/src/features/dashboard/components/__tests__/ActionBar.test.tsx
Eric Gullickson f6684e72c0
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 3m22s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 51s
Deploy to Staging / Verify Staging (pull_request) Successful in 8s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
test: add dashboard redesign tests (refs #201)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 11:03:52 -06:00

39 lines
1.2 KiB
TypeScript

import { render, screen, fireEvent } from '@testing-library/react';
import { ActionBar } from '../ActionBar';
describe('ActionBar', () => {
it('renders both buttons with correct text', () => {
const onAddVehicle = jest.fn();
const onLogFuel = jest.fn();
render(<ActionBar onAddVehicle={onAddVehicle} onLogFuel={onLogFuel} />);
expect(screen.getByText('Add Vehicle')).toBeInTheDocument();
expect(screen.getByText('Log Fuel')).toBeInTheDocument();
});
it('calls onAddVehicle when Add Vehicle button clicked', () => {
const onAddVehicle = jest.fn();
const onLogFuel = jest.fn();
render(<ActionBar onAddVehicle={onAddVehicle} onLogFuel={onLogFuel} />);
const addVehicleButton = screen.getByText('Add Vehicle');
fireEvent.click(addVehicleButton);
expect(onAddVehicle).toHaveBeenCalledTimes(1);
});
it('calls onLogFuel when Log Fuel button clicked', () => {
const onAddVehicle = jest.fn();
const onLogFuel = jest.fn();
render(<ActionBar onAddVehicle={onAddVehicle} onLogFuel={onLogFuel} />);
const logFuelButton = screen.getByText('Log Fuel');
fireEvent.click(logFuelButton);
expect(onLogFuel).toHaveBeenCalledTimes(1);
});
});