Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 12 additions & 30 deletions __tests__/Unit/Components/Tasks/FilterDropdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('FilterDropdown', () => {
test('renders the modal with correct title and buttons', () => {
renderWithRouter(
<FilterDropdown
tabs={[Tab.UNASSIGNED, Tab.COMPLETED]}
tabs={[Tab.UNASSIGNED, Tab.DONE]}
onSelect={mockOnSelect}
activeTab={Tab.UNASSIGNED}
onClose={mockOnClose}
Expand All @@ -76,8 +76,8 @@ describe('FilterDropdown', () => {
const unassignedButton = screen.getByText(/unassigned/i);
expect(unassignedButton).toBeInTheDocument();

const completedButton = screen.getByText(/completed/i);
expect(completedButton).toBeInTheDocument();
const doneButton = screen.getByText(/done/i);
expect(doneButton).toBeInTheDocument();
});

test('calls onSelect and onClose when a status button is clicked', () => {
Expand Down Expand Up @@ -170,15 +170,15 @@ describe('FilterDropdown', () => {
test('renders the modal with correct active tab', () => {
renderWithRouter(
<FilterDropdown
tabs={[Tab.UNASSIGNED, Tab.COMPLETED]}
tabs={[Tab.UNASSIGNED, Tab.DONE]}
onSelect={mockOnSelect}
activeTab={Tab.COMPLETED}
activeTab={Tab.DONE}
onClose={mockOnClose}
/>
);

const completedButton = screen.getByText(/completed/i);
expect(completedButton).toHaveClass('status-button-active');
const doneButton = screen.getByText(/done/i);
expect(doneButton).toHaveClass('status-button-active');

const unassignedButton = screen.getByText(/unassigned/i);
expect(unassignedButton).not.toHaveClass('status-button-active');
Expand Down Expand Up @@ -217,7 +217,7 @@ describe('FilterDropdown', () => {
test('Selection of the Backlog Button', () => {
renderWithRouter(
<FilterDropdown
tabs={[Tab.BACKLOG, Tab.COMPLETED]}
tabs={[Tab.BACKLOG, Tab.DONE]}
onSelect={mockOnSelect}
activeTab={Tab.BACKLOG}
onClose={mockOnClose}
Expand All @@ -227,21 +227,18 @@ describe('FilterDropdown', () => {
const backlogButton = screen.getByText(/backlog/i);
expect(backlogButton).toHaveClass('status-button-active');

const completedButton = screen.getByText(/completed/i);
expect(completedButton).not.toHaveClass('status-button-active');
const doneButton = screen.getByText(/done/i);
expect(doneButton).not.toHaveClass('status-button-active');
});

it('Renders Task tab Done, when dev flag is on', async () => {
it('Renders Task tab Done', async () => {
renderWithRouter(
<FilterDropdown
tabs={[Tab.BACKLOG, Tab.COMPLETED, Tab.DONE]}
onSelect={mockOnSelect}
activeTab={Tab.DONE}
onClose={mockOnClose}
/>,
{
query: { dev: 'true' },
}
/>
);

const doneButton = screen.queryByText(/done/i);
Expand All @@ -250,19 +247,4 @@ describe('FilterDropdown', () => {
expect(doneButton).toBeInTheDocument();
expect(completedButton).toBeNull();
});
it('Renders Task status Completed, when dev flag is not on', async () => {
renderWithRouter(
<FilterDropdown
tabs={[Tab.BACKLOG, Tab.COMPLETED, Tab.DONE]}
onSelect={mockOnSelect}
activeTab={Tab.COMPLETED}
onClose={mockOnClose}
/>
);
const doneButton = screen.queryByText(/done/i);
const completedButton = screen.queryByText(/completed/i);

expect(completedButton).toBeInTheDocument();
expect(doneButton).toBeNull();
});
});
5 changes: 1 addition & 4 deletions src/components/tasks/TaskSearch/FilterDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ const FilterDropdown = ({
.filter(
(tab: Tab) =>
!depreciatedTaskStatus.includes(tab) &&
!(
(isDevMode && tab === 'COMPLETED') ||
(!isDevMode && tab === 'DONE')
)
tab !== 'COMPLETED'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't even need this check, we have a export const depreciatedTaskStatus = ['AVAILABLE']; at@/interfaces/task.type, add this status value in that array, it would be skipped anyway.

)
.map((tab) => (
<button
Expand Down