Skip to content

Commit

Permalink
Add close flag form test
Browse files Browse the repository at this point in the history
  • Loading branch information
kahummer committed Jul 16, 2024
1 parent 4ddad4b commit f18156d
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';
import { render } from '@testing-library/react';
import { CloseFlagForm, CloseFlagFormProps } from '..';
import { flag } from '../../Utils/tests/fixtures';

// Mock useMutation hook
jest.mock('react-query', () => ({
useMutation: jest.fn((mutationFn) => ({
mutate: jest.fn((values) => mutationFn(values)),
isLoading: false,
})),
}));

describe('CloseFlagForm component', () => {
const mockMutationEffect = jest.fn();

const props: CloseFlagFormProps = {
fhirBaseUrl: 'mockBaseUrl',
initialValues: { status: 'active' },
flag: flag,
mutationEffect: mockMutationEffect,
};

it('renders form fields correctly', () => {
const { getByLabelText } = render(<CloseFlagForm {...props} />);

// Check if form fields are rendered
expect(getByLabelText('Service Point')).toBeInTheDocument();
expect(getByLabelText('Product')).toBeInTheDocument();
expect(getByLabelText('Status')).toBeInTheDocument();
expect(getByLabelText('Comments')).toBeInTheDocument();

// You can add more specific assertions as needed
});
});

0 comments on commit f18156d

Please sign in to comment.