"""Envelope tests for commit command.""" from __future__ import annotations from collections.abc import Mapping import json import pytest from tests.cli_test_helper import CliRunner runner = CliRunner() _FIELDS = ("muse_version", "schema", "timestamp", "warnings") def _check(d: Mapping[str, object]) -> None: for f in _FIELDS: assert f in d, f"missing {f}" assert "schema_version" not in d class TestCommitEnvelope: def test_commit_dry_run_has_envelope(self) -> None: r = runner.invoke(None, ["commit", "-m", "test", "--dry-run", "--json"]) # May exit 0 (changes) or 1 (clean), both should emit an envelope d = json.loads(r.output) _check(d)