= (props: Engagements
-
-
),
EngagementsFilter: function MockEngagementsFilter(props: {
- filters: { title?: string }
- onFiltersChange: (nextFilters: { title?: string }) => void
+ filters: { status?: string[]; title?: string }
+ onFiltersChange: (nextFilters: { status?: string[]; title?: string }) => void
}) {
function handleApplyTitleFilter(): void {
props.onFiltersChange({
@@ -114,6 +114,13 @@ jest.mock('../../../lib/components', () => ({
})
}
+ function handleApplyStatusFilter(): void {
+ props.onFiltersChange({
+ ...props.filters,
+ status: ['Open', 'Active'],
+ })
+ }
+
return (
+
)
},
@@ -453,6 +466,29 @@ describe('EngagementsListPage', () => {
})
})
+ it('passes selected engagement statuses to engagement fetch requests', async () => {
+ renderPage('/engagements', '/engagements')
+
+ fireEvent.click(screen.getByRole('button', { name: 'Apply status filter' }))
+
+ await waitFor(() => {
+ expect(mockedUseFetchEngagements)
+ .toHaveBeenLastCalledWith(
+ undefined,
+ {
+ includePrivate: true,
+ projectId: undefined,
+ sortBy: 'createdAt',
+ sortOrder: 'desc',
+ status: ['Open', 'Active'],
+ },
+ {
+ enabled: true,
+ },
+ )
+ })
+ })
+
it('renders the engagement view link without the legacy opportunities path segment', () => {
mockedUseFetchEngagements.mockReturnValue({
engagements: [