File size: 750 Bytes
53052e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from api.vfs_sync import build_vfs_sync_complete


def test_vfs_sync_commit_includes_sorted_unique_files_after_success():
    event = build_vfs_sync_complete(
        "task-123",
        {"reports/data.json", "e2e_metrics.json", "reports/data.json"},
        {"success": True, "output": "ok"},
    )

    assert event == {
        "taskId": "task-123",
        "files": ["e2e_metrics.json", "reports/data.json"],
    }


def test_vfs_sync_commit_is_omitted_without_files():
    assert build_vfs_sync_complete("task-123", set(), {"success": True}) is None


def test_vfs_sync_commit_is_omitted_after_failed_loop():
    assert build_vfs_sync_complete(
        "task-123", {"e2e_metrics.json"}, {"success": False, "error": "write failed"}
    ) is None