diff --git a/client/src/components/Files/docsync/DocSyncConnectModal.test.tsx b/client/src/components/Files/docsync/DocSyncConnectModal.test.tsx index 7e2a835c5..bb2b6b883 100644 --- a/client/src/components/Files/docsync/DocSyncConnectModal.test.tsx +++ b/client/src/components/Files/docsync/DocSyncConnectModal.test.tsx @@ -502,7 +502,10 @@ describe('DocSyncConnectModal with a connection already stored', () => { describe('DocSyncConnectModal removal', () => { const removeButton = () => screen.queryByRole('button', { name: tx('docsync.connection.remove') }) // The confirmation is portalled after the dialog, so its button is the last one of that name. - const confirmRemoval = () => screen.getAllByRole('button', { name: tx('docsync.connection.remove') }).at(-1)! + const confirmRemoval = () => { + const named = screen.getAllByRole('button', { name: tx('docsync.connection.remove') }) + return named[named.length - 1] + } async function openWithRemoval(stored: boolean) { if (stored) listConnections.mockResolvedValue([connection()]) @@ -516,7 +519,7 @@ describe('DocSyncConnectModal removal', () => { const onRemoved = await openWithRemoval(true) await waitFor(() => expect(removeButton()).toBeInTheDocument()) - fireEvent.click(removeButton()!) + fireEvent.click(screen.getByRole('button', { name: tx('docsync.connection.remove') })) expect(deleteConnection).not.toHaveBeenCalled() await screen.findByText(tx('docsync.connection.confirmRemove')) fireEvent.click(confirmRemoval()) @@ -530,7 +533,7 @@ describe('DocSyncConnectModal removal', () => { const onRemoved = await openWithRemoval(true) await waitFor(() => expect(removeButton()).toBeInTheDocument()) - fireEvent.click(removeButton()!) + fireEvent.click(screen.getByRole('button', { name: tx('docsync.connection.remove') })) await screen.findByText(tx('docsync.connection.confirmRemove')) fireEvent.click(confirmRemoval()) diff --git a/client/src/mobile/screens/trip/tabs/MDocSyncSheet.test.tsx b/client/src/mobile/screens/trip/tabs/MDocSyncSheet.test.tsx index c7af2e9e3..37ad44968 100644 --- a/client/src/mobile/screens/trip/tabs/MDocSyncSheet.test.tsx +++ b/client/src/mobile/screens/trip/tabs/MDocSyncSheet.test.tsx @@ -548,7 +548,9 @@ describe('MDocSyncSheet: the stored connection', () => { fireEvent.click(removeButtons()[0]) expect(docsyncApi.deleteConnection).not.toHaveBeenCalled() expect(await screen.findByText(/TREK forgets the address and login/)).toBeInTheDocument() - fireEvent.click(removeButtons().at(-1)!) + // The confirmation sheet opens over the form, so its button is the last one of that name. + const named = removeButtons() + fireEvent.click(named[named.length - 1]) await waitFor(() => expect(docsyncApi.deleteConnection).toHaveBeenCalledWith(TRIP_ID, 5)) // Back at the list, with Paperless offered again from scratch. diff --git a/server/tests/unit/mcp/tools-notes.test.ts b/server/tests/unit/mcp/tools-notes.test.ts index 4ab0ee7f8..d82a77c0c 100644 --- a/server/tests/unit/mcp/tools-notes.test.ts +++ b/server/tests/unit/mcp/tools-notes.test.ts @@ -104,7 +104,7 @@ describe('Tool: create_day_note', () => { await withHarness(user.id, async (h) => { const { tools } = await h.client.listTools(); for (const name of ['create_day_note', 'update_day_note']) { - const props = tools.find((t) => t.name === name)?.inputSchema.properties as Record; + const props = tools.find((t) => t.name === name)?.inputSchema.properties as Record; // The nullable body may come out as an anyOf, so read the property whole. const time = JSON.stringify(props.time); expect(JSON.stringify(props.text)).toMatch(/title/i); @@ -125,7 +125,7 @@ describe('Tool: create_day_note', () => { name: 'create_day_note', arguments: { tripId: trip.id, dayId: day.id, text: 'Museum day', time: body }, }); - const data = parseToolResult(result) as any; + const data = parseToolResult(result) as { note: { id: number } }; expect((await dayNote(data.note.id)).time).toBe(body); const tooLong = await h.client.callTool({ name: 'create_day_note',