From 63feb889121e0f00fc7cb05e9fd309b993f8a464 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Mon, 19 Oct 2026 11:17:10 +0200 Subject: [PATCH] test(book): prove a task is found by full-text, not only a note The dossier's verification wants a note *and* a task found by find(); the previous version only ever searched for the note's words. Search for the task's own body text and assert it is the record returned. Co-Authored-By: Claude Sonnet 5 --- tests/test_book.py | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/tests/test_book.py b/tests/test_book.py index 2c75477..5765648 100644 --- a/tests/test_book.py +++ b/tests/test_book.py @@ -184,24 +184,37 @@ class TestAddShowListFind: assert work_only["total"] == 1 assert work_only["records"][0]["scope"] == "work" - def test_find_full_text_matches_title_and_body(self, client): - client.post( + def test_find_full_text_matches_a_note_and_a_task(self, client): + """Dossier verification #4: a note and a task, both found by full-text.""" + note = client.post( "/book/records", json={"kind": "note", "title": "Weekend plans", "body": "visit the garden centre"}, headers=office_headers(), - ) - client.post( + ).json() + task = client.post( "/book/records", json={"kind": "task", "body": "renew the car insurance"}, headers=office_headers(), - ) + ).json() - found = client.get("/book/records/find", params={"q": "garden"}, headers=office_headers()).json() - assert found["total"] == 1 - assert "garden" in found["records"][0]["body"] + found_note_by_body = client.get( + "/book/records/find", params={"q": "garden"}, headers=office_headers() + ).json() + assert found_note_by_body["total"] == 1 + assert found_note_by_body["records"][0]["id"] == note["id"] - found_title = client.get("/book/records/find", params={"q": "weekend"}, headers=office_headers()).json() - assert found_title["total"] == 1 + found_note_by_title = client.get( + "/book/records/find", params={"q": "weekend"}, headers=office_headers() + ).json() + assert found_note_by_title["total"] == 1 + assert found_note_by_title["records"][0]["id"] == note["id"] + + found_task = client.get( + "/book/records/find", params={"q": "insurance"}, headers=office_headers() + ).json() + assert found_task["total"] == 1 + assert found_task["records"][0]["id"] == task["id"] + assert found_task["records"][0]["kind"] == "task" class TestChange: