Skip to content
Merged
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
13 changes: 13 additions & 0 deletions frontend/src/v2/__tests__/ConnectorsPage.tools.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,19 @@ describe('Connectors page: tools', () => {
expect(meta()).toHaveTextContent('0 on · 0 available');
});

it('TASK-752: a revoked grant whose catalogue entry is gone is not listed in Tools, only the live one is', async () => {
// No catalogue entry covers either grant, so both are orphans. Only the live one is
// still access; the revoked one must not draw a row beside it.
mockTools({ entries: [], grants: [grantLive, grantRevoked] });
renderPage();

const tools = await screen.findByRole('region', { name: 'Tools' });
await settle();
const rows = tools.querySelectorAll('.v2-connector-row');
expect(rows).toHaveLength(1);
expect(rows[0]).not.toHaveClass('v2-connector-row--dead');
});

/**
* Scope §4, step 7's named test: "the page's call to start is credentialed".
*
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/v2/connectors/ConnectorsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,12 @@ const ConnectorsPage: React.FC = () => {
&& (!q || connection.label.toLowerCase().includes(q))
));
// A grant whose catalogue entry is gone (retired or unreadable) has no tile, but it
// is still live access: it stays listed so it can still be seen and revoked.
// is still live access: it stays listed so it can still be seen and revoked. A dead
// one is not access any more, so it leaves the list (TASK-752); the Connectors trail
// keeps the record.
const orphanGrants = grants.filter((grant) => (
!m.catalog.some((entry) => entryCovers(entry, grant))
&& !isDead(grant, m.now)
&& (!q || m.toolLabel(grant).toLowerCase().includes(q))
));
const toolHasDrawer = (entry: ToolCatalogEntry): boolean => grantsOf(entry).length > 0 || hiddenOf(entry).length > 0;
Expand Down
Loading