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 <noreply@anthropic.com>
This commit is contained in:
+23
-10
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user