Files
webmail-client/backend/tests/sync/test_folder_names.py
T

35 lines
930 B
Python
Raw Normal View History

2026-07-17 23:20:34 +02:00
"""Folder-name special-use heuristics (SPEC §6.3)."""
from __future__ import annotations
import pytest
from app.sync.folder_names import infer_special_use
@pytest.mark.parametrize(
"path,expected",
[
("INBOX", "inbox"),
("inbox", "inbox"),
("Sent", "sent"),
("Wysłane", "sent"), # Polish
("Elementy wysłane", "sent"),
("Gesendet", "sent"), # German
("Drafts", "drafts"),
("Robocze", "drafts"),
("Trash", "trash"),
("Kosz", "trash"), # Polish
("Papierkorb", "trash"), # German
("Spam", "junk"),
("Junk", "junk"),
("Archive", "archive"),
("Archiwum", "archive"),
("INBOX/Sent", "sent"), # nested leaf
("Work", None),
("Random Folder", None),
],
)
def test_infer_special_use(path: str, expected: str | None) -> None:
assert infer_special_use(path) == expected