test: add full test suite with 100% coverage across all modules
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -42,3 +42,23 @@ class TestScoreboardRoute:
|
||||
response = flask_client.get("/scoreboard")
|
||||
data = json.loads(response.data)
|
||||
assert "error" in data
|
||||
|
||||
def test_invalid_json_returns_error(self, flask_client, monkeypatch, tmp_path):
|
||||
import app.routes as routes
|
||||
|
||||
bad_file = tmp_path / "bad.json"
|
||||
bad_file.write_text("not valid json {{{")
|
||||
monkeypatch.setattr(routes, "SCOREBOARD_DATA_FILE", str(bad_file))
|
||||
response = flask_client.get("/scoreboard")
|
||||
data = json.loads(response.data)
|
||||
assert "error" in data
|
||||
|
||||
def test_null_json_returns_error(self, flask_client, monkeypatch, tmp_path):
|
||||
import app.routes as routes
|
||||
|
||||
null_file = tmp_path / "null.json"
|
||||
null_file.write_text("null")
|
||||
monkeypatch.setattr(routes, "SCOREBOARD_DATA_FILE", str(null_file))
|
||||
response = flask_client.get("/scoreboard")
|
||||
data = json.loads(response.data)
|
||||
assert "error" in data
|
||||
|
||||
Reference in New Issue
Block a user