Extract base.html inline JS to separate file and update test expectations

- Extracted ~1250 lines of JavaScript from base.html to static/base.js
- Reduced base.html from ~2700 lines to ~1440 lines
- Updated tests to expect 404 (not 500) for invalid resources
- Updated CLAUDE.md to reflect proper error handling

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-02 12:57:57 -05:00
parent 7b6758c021
commit 8322a88edd
5 changed files with 1265 additions and 1265 deletions
+1 -1
View File
@@ -244,7 +244,7 @@ docker compose exec web uv run pytest tests/ -v # Run tests in container
- Use `uv` for all Python package management
- API responses use `name` field for books, not `book`
- API responses use `start`/`end` for verse ranges, not `start_verse`/`end_verse`
- Error handling currently returns 500 for invalid inputs (should be 404, but tests accept both)
- Error handling returns proper 404 for invalid inputs (not found resources)
- Book abbreviations are comprehensive but some edge cases may not work
- The project uses Tufte CSS for clean, readable typography
- Interlinear data is available for most verses but not all
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -4
View File
@@ -64,8 +64,7 @@ class TestVerseEndpoints:
def test_get_nonexistent_verse(self, client):
"""Test verse endpoint with invalid verse"""
response = client.get("/api/verse/John/3/999")
# Currently returns 500, should return 404
assert response.status_code in [404, 500]
assert response.status_code == 404
def test_get_verse_range(self, client):
"""Test /api/verse-range/{book}/{chapter}/{start}/{end}"""
@@ -326,8 +325,7 @@ class TestInterlinearEndpoint:
def test_get_interlinear_nonexistent_verse(self, client):
"""Test interlinear with invalid verse"""
response = client.get("/api/interlinear/John/1/999")
# Currently returns 500, should return 404
assert response.status_code in [404, 500]
assert response.status_code == 404
class TestCrossReferencesEndpoint:
+4 -4
View File
@@ -12,17 +12,17 @@ class TestErrorHandling:
def test_invalid_book_name(self, client):
"""Test verse endpoint with non-existent book"""
response = client.get("/api/verse/NotABook/1/1")
assert response.status_code in [404, 500]
assert response.status_code == 404
def test_invalid_chapter_number(self, client):
"""Test verse endpoint with invalid chapter"""
response = client.get("/api/verse/Genesis/999/1")
assert response.status_code in [404, 500]
assert response.status_code == 404
def test_invalid_verse_number(self, client):
"""Test verse endpoint with invalid verse"""
response = client.get("/api/verse/John/3/999")
assert response.status_code in [404, 500]
assert response.status_code == 404
def test_negative_chapter(self, client):
"""Test verse endpoint with negative chapter"""
@@ -98,7 +98,7 @@ class TestBookAbbreviations:
for abbrev, full_name in abbreviations.items():
response = client.get(f"/api/books/{abbrev}")
assert response.status_code in [200, 404, 500]
assert response.status_code in [200, 404]
if response.status_code == 200:
data = response.json()
# Response has "name" field, not "book"