"""Tests for snapshot flag encoding (mgf.vm.core.operations.snapshot_flags)."""

from __future__ import annotations

from mgf.vm.core.operations.snapshot_flags import encode_flags


def test_no_flags_returns_description_unchanged() -> None:
    assert encode_flags("nightly", quiesce=False, external=False) == "nightly"


def test_no_flags_empty_description() -> None:
    assert encode_flags("", quiesce=False, external=False) == ""


def test_quiesce_only() -> None:
    assert encode_flags("desc", quiesce=True, external=False) == "[vmanager:quiesce] desc"


def test_external_only() -> None:
    assert encode_flags("desc", quiesce=False, external=True) == "[vmanager:external] desc"


def test_both_flags_order_is_quiesce_then_external() -> None:
    assert encode_flags("d", quiesce=True, external=True) == "[vmanager:quiesce,external] d"


def test_prefix_only_when_description_empty() -> None:
    assert encode_flags("", quiesce=True, external=False) == "[vmanager:quiesce]"
    assert encode_flags("", quiesce=True, external=True) == "[vmanager:quiesce,external]"
