mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 11:36:05 +00:00
test: keep the new day-note and document-sync tests inside the lint and type gates
This commit is contained in:
@@ -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())
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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<string, any>;
|
||||
const props = tools.find((t) => t.name === name)?.inputSchema.properties as Record<string, unknown>;
|
||||
// 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',
|
||||
|
||||
Reference in New Issue
Block a user