Co-authored-by: Maxime Dolores <maxime.dolores@ext.mistral.ai>
Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com>
Co-authored-by: Peter Evers <peter.evers@mistral.ai>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Quentin <quentin.torroba@mistral.ai>
Co-authored-by: Val <102326092+vdeva@users.noreply.github.com>
Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Clément Drouin 2026-05-29 16:17:54 +02:00 committed by GitHub
parent 198277af3f
commit ad0d5c9520
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
61 changed files with 969 additions and 461 deletions

View file

@ -11,6 +11,7 @@ from vibe.cli.plan_offer.decide_plan_offer import (
PlanInfo,
WhoAmIPlanType,
decide_plan_offer,
plan_offer_cta,
resolve_api_key_for_plan,
)
from vibe.cli.plan_offer.ports.whoami_gateway import WhoAmIResponse
@ -174,6 +175,47 @@ def test_resolve_api_key_for_plan_with_missing_env_var() -> None:
environ["MISTRAL_API_KEY"] = previous_api_key
@pytest.mark.parametrize(
("plan_info", "expected_cta"),
[
(
PlanInfo(
plan_type=WhoAmIPlanType.CHAT,
plan_name="INDIVIDUAL",
prompt_switching_to_pro_plan=True,
),
"### Switch to your [Vibe Pro API key](https://chat.mistral.ai/code/extensions?focus=key)",
),
(
PlanInfo(
plan_type=WhoAmIPlanType.API,
plan_name="FREE",
prompt_switching_to_pro_plan=False,
),
"### Unlock more with Vibe - [Upgrade to Vibe Pro](https://chat.mistral.ai/code/extensions?focus=key)",
),
],
ids=["switch-to-vibe-pro-key", "upgrade-to-vibe-pro"],
)
def test_plan_offer_cta_routes_users_to_vibe_api_key_extensions(
plan_info: PlanInfo, expected_cta: str
) -> None:
assert plan_offer_cta(plan_info) == expected_cta
def test_plan_offer_cta_uses_configured_vibe_url() -> None:
plan_info = PlanInfo(
plan_type=WhoAmIPlanType.CHAT,
plan_name="INDIVIDUAL",
prompt_switching_to_pro_plan=True,
)
assert (
plan_offer_cta(plan_info, vibe_base_url="https://vibe.example.com/")
== "### Switch to your [Vibe Pro API key](https://vibe.example.com/code/extensions?focus=key)"
)
@pytest.mark.parametrize(
("response", "expected"),
[

View file

@ -12,14 +12,12 @@ class TestCompactMessage:
message.post_message = MagicMock()
message.set_complete(
old_tokens=177_017,
new_tokens=23_263,
old_session_id="11111111-1111-1111-1111-111111111111",
new_session_id="22222222-2222-2222-2222-222222222222",
)
assert message.get_content() == (
"Compaction complete: 177,017 → 23,263 tokens (-87.%)\n"
"Compaction completed.\n"
"session: "
f"{shorten_session_id('11111111-1111-1111-1111-111111111111')} "
"(before compaction) → "