feat(ui): onboarding suggestion chips with one-tap submit, keyboard access, and mobile scroll row
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
"""Unit tests: settings defaults & env overrides."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
from pydantic_settings import SettingsError
|
||||
|
||||
from app.config import Settings
|
||||
|
||||
|
||||
@@ -32,6 +36,31 @@ def test_env_override(monkeypatch) -> None:
|
||||
assert s.llm_chat_model == "juggernaut"
|
||||
|
||||
|
||||
def test_suggestions_default_is_three_plus_real_questions() -> None:
|
||||
s = _settings()
|
||||
assert len(s.suggestions) >= 3
|
||||
assert all(isinstance(q, str) and q.strip() for q in s.suggestions)
|
||||
# Distinct chips only — duplicates in the onboarding row are noise.
|
||||
assert len({q.strip().lower() for q in s.suggestions}) == len(s.suggestions)
|
||||
|
||||
|
||||
def test_suggestions_env_override_is_json_list(monkeypatch) -> None:
|
||||
override = [
|
||||
"How do I back up with Borg?",
|
||||
"How is my K3S cluster set up?",
|
||||
"How do I deploy a service?",
|
||||
]
|
||||
monkeypatch.setenv("BOR_SUGGESTIONS", json.dumps(override))
|
||||
s = _settings()
|
||||
assert s.suggestions == override
|
||||
|
||||
|
||||
def test_suggestions_malformed_json_fails_loudly(monkeypatch) -> None:
|
||||
monkeypatch.setenv("BOR_SUGGESTIONS", "[not valid json")
|
||||
with pytest.raises(SettingsError):
|
||||
_settings()
|
||||
|
||||
|
||||
def test_effective_api_key_fallback(monkeypatch) -> None:
|
||||
monkeypatch.delenv("AIPI_KEY", raising=False)
|
||||
s = _settings()
|
||||
|
||||
Reference in New Issue
Block a user