import pytest
from core.graph.builder import MindGraphBuilder

class TestGraphBuilder:
    @pytest.fixture
    def builder(self):
        return MindGraphBuilder()

    def test_node_conflict(self, builder):
        builder.add_node("A", "初始内容")
        builder.new_version()
        builder.add_node("A", "新内容")
        assert "|" in builder.nodes["A"]["content"]
        
    def test_edge_weights(self, builder):
        builder.add_edge("S", "T")
        builder.add_edge("S", "T")
        assert builder.edges[0]['weight'] == 1.2
