"""Unit tests for project dataset naming (transparent prefix)."""

from ims_mcp.tools.projects import _to_dataset_name, _to_project_name


class TestToDatasetName:
    def test_adds_prefix(self):
        assert _to_dataset_name("myapp") == "project-myapp"

    def test_no_double_prefix(self):
        assert _to_dataset_name("project-myapp") == "project-myapp"

    def test_empty(self):
        assert _to_dataset_name("") == "project-"


class TestToProjectName:
    def test_strips_prefix(self):
        assert _to_project_name("project-myapp") == "myapp"

    def test_no_prefix_passthrough(self):
        assert _to_project_name("myapp") == "myapp"

    def test_prefix_only(self):
        assert _to_project_name("project-") == ""
