diff --git a/packages/web/src/pages/agent/agent-home-page.test.tsx b/packages/web/src/pages/agent/agent-home-page.test.tsx new file mode 100644 index 0000000..84b87bf --- /dev/null +++ b/packages/web/src/pages/agent/agent-home-page.test.tsx @@ -0,0 +1,38 @@ +/// + +import {afterEach, describe, expect, test} from 'bun:test'; +import {cleanup, render, screen} from '@testing-library/react'; +import {createMemoryRouter, RouterProvider} from 'react-router'; +import {AgentSide} from '@/components/agent-side'; +import {AgentHomePage} from '@/pages/agent/agent-home-page'; + +afterEach(() => { + cleanup(); +}); + +describe('AgentHomePage', () => { + test('directs a login without access to the Connections page', async () => { + const router = createMemoryRouter( + [ + { + id: 'agent', + loader: () => ({ + agent: {id: 'agent-1', providerId: 'claude', name: 'Claude'}, + connections: [], + }), + element: , + children: [{path: '/agent', element: }], + }, + ], + {initialEntries: ['/agent']}, + ); + + render(); + + expect( + await screen.findByText( + 'No connections are available to this login yet. Ask the person who set it up to add a service on the Connections page, or give this login access to one already connected.', + ), + ).toBeDefined(); + }); +}); diff --git a/packages/web/src/pages/agent/agent-home-page.tsx b/packages/web/src/pages/agent/agent-home-page.tsx index 25aff0c..0348a03 100644 --- a/packages/web/src/pages/agent/agent-home-page.tsx +++ b/packages/web/src/pages/agent/agent-home-page.tsx @@ -24,7 +24,8 @@ export function AgentHomePage() { {connections.length === 0 && (

- This login has no access yet. Ask the person who made it to give it some. + No connections are available to this login yet. Ask the person who set it up to add a + service on the Connections page, or give this login access to one already connected.

)} {connections.map((connection) => {