def test_wikilink_extraction_duplicates(tmp_path: Path):
    """
    Test that duplicate wikilinks (with or without aliases) are only stored once.
    """
    content = "See [[Note]] and also [[Note|Alias]]."
    create_markdown_file(tmp_path, "dup_wikilinks.md", content)

    reader = ObsidianReader(input_dir=str(tmp_path))
    docs = reader.load_data()
    assert len(docs) == 1
    doc = docs[0]
    wikilinks: List[str] = doc.metadata.get("wikilinks", [])
    # Only one unique wikilink should be present.
    assert set(wikilinks) == {"Note"}

    Test that duplicate wikilinks (with or without aliases) are only stored once.
    
llama-index-integrations/readers/llama-index-readers-obsidian/tests/test_readers_obsidian.py