Kairo-Jinkendo/backend/tests/test_portfolio_steering_unit.py
Lars b6434bcc50
All checks were successful
Deploy Development / deploy (push) Successful in 48s
Test Suite / pytest-backend (push) Successful in 4m14s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 12s
feat(steering): K-Ext-5 Portfolio-Kernel-Aggregation ueber Initiativen
GET /api/workspace/steering; Portfolio-Widget nutzt Kernel-Attention, Vorschlaege und Agent-Slots.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 13:13:36 +02:00

30 lines
1.0 KiB
Python

"""Unit tests for portfolio steering aggregation."""
from __future__ import annotations
from steering.portfolio.aggregate import _sort_attention, _sort_next_work
def test_sort_attention_by_severity_then_portfolio_rank():
items = [
{"severity": "info", "portfolio_rank": 0, "title": "B"},
{"severity": "critical", "portfolio_rank": 2, "title": "A"},
{"severity": "warning", "portfolio_rank": 1, "title": "C"},
]
sorted_items = _sort_attention(items)
assert sorted_items[0]["severity"] == "critical"
assert sorted_items[1]["severity"] == "warning"
assert sorted_items[2]["severity"] == "info"
def test_sort_next_work_by_portfolio_rank():
items = [
{"portfolio_rank": 2, "title": "Late"},
{"portfolio_rank": 0, "title": "First"},
{"portfolio_rank": None, "title": "Unranked"},
]
sorted_items = _sort_next_work(items)
assert sorted_items[0]["title"] == "First"
assert sorted_items[1]["title"] == "Late"
assert sorted_items[2]["title"] == "Unranked"