feat(frontend): show inactive tasks on entity page

Return all tasks for an entity so inactive items remain visible in the entity detail view while global task listings stay active-only.

Add inactive task styling and coverage for the entity page state.
This commit is contained in:
2026-03-27 01:10:15 -03:00
parent 10c83d4e5a
commit 1a7f5d706a
4 changed files with 223 additions and 163 deletions

View File

@@ -54,7 +54,14 @@ describe('tasksApi', () => {
it('should_returnTasksForEntity_when_getTasksByEntityCalled', async () => {
localStorage.setItem('condado:entity-tasks', JSON.stringify([taskOne, taskTwo]))
await expect(getTasksByEntity('entity-1')).resolves.toEqual([taskOne])
await expect(getTasksByEntity('entity-1')).resolves.toEqual([
taskOne,
{
...taskOne,
id: 'task-3',
active: false,
},
])
})
it('should_hideInactiveTasks_when_getAllTasksCalled', async () => {

View File

@@ -64,4 +64,39 @@ describe('EntityDetailPage', () => {
)
})
})
it('should_renderInactiveTasksWithStatus_when_entityHasInactiveTasks', async () => {
vi.mocked(tasksApi.getEmailLookbackLabel).mockReturnValue('Last week')
vi.mocked(entitiesApi.getEntity).mockResolvedValue({
id: 'entity-1',
name: 'Entity A',
email: 'a@a.com',
jobTitle: 'Ops',
personality: 'Formal',
scheduleCron: '0 9 * * 1',
contextWindowDays: 3,
active: true,
createdAt: '',
})
vi.mocked(tasksApi.getTasksByEntity).mockResolvedValue([
{
id: 'task-2',
entityId: 'entity-1',
name: 'Retired Task',
prompt: 'Archive the sandwich minutes',
scheduleCron: '0 9 * * 1',
emailLookback: 'last_week',
active: false,
createdAt: '2026-03-26T10:00:00Z',
},
])
render(<EntityDetailPage />, { wrapper })
await waitFor(() => {
expect(screen.getByText(/Retired Task/i)).toBeInTheDocument()
expect(screen.getByText(/Inactive/i)).toBeInTheDocument()
})
})
})