feat: review mobile update triage outcomes (Closes #765)
This commit is contained in:
1 parent
e21cc58cca
commit
fd2f801f3e
5 files changed
+105
-10
No files matched your search
@@ -47,11 +47,12 @@ process.stdout.write(JSON.stringify({opened, progress, saved, resumable, isolate
|
||||
{"index": 2, "total": 3},
|
||||
]
|
||||
assert result["saved"] == {
|
||||
"version": 1,
|
||||
"version": 2,
|
||||
"login": "timmy",
|
||||
"identities": ["1", "2", "3"],
|
||||
"current": "2",
|
||||
"completed": ["1"],
|
||||
"kept": ["1"],
|
||||
}
|
||||
assert result["resumable"] is True
|
||||
assert result["isolated"] is False
|
||||
@@ -102,6 +103,52 @@ process.stdout.write(JSON.stringify({first, afterRemoval, afterAdvance:afterAdva
|
||||
assert result == {"first": 2, "afterRemoval": 3, "afterAdvance": None}
|
||||
|
||||
|
||||
def test_update_triage_reports_truthful_outcomes_and_reopens_only_surviving_kept_items():
|
||||
result = run_session("""
|
||||
const values = new Map();
|
||||
let items = [1,2,3].map(notification_id => ({notification_id}));
|
||||
const opened = [], outcomes = [];
|
||||
const session = createSession({
|
||||
storage:{getItem:key=>values.get(key)||null,setItem:(key,value)=>values.set(key,value),removeItem:key=>values.delete(key)},
|
||||
getLogin:()=> 'timmy', getItems:()=>items,
|
||||
onOpen:item=>opened.push(item.notification_id), onProgress:()=>{}, onFinish:value=>outcomes.push(value),
|
||||
});
|
||||
session.start();
|
||||
session.keepUnreadAndNext();
|
||||
session.completeAndNext();
|
||||
items = [1,3].map(notification_id => ({notification_id}));
|
||||
session.keepUnreadAndNext();
|
||||
const reviewed = session.reviewKept();
|
||||
process.stdout.write(JSON.stringify({opened, outcomes, reviewed}));
|
||||
""")
|
||||
|
||||
assert result == {
|
||||
"opened": [1, 2, 3, 1],
|
||||
"outcomes": [{"reviewed": 3, "resolved": 1, "kept": 2, "keptIdentities": ["1", "3"]}],
|
||||
"reviewed": True,
|
||||
}
|
||||
|
||||
|
||||
def test_update_triage_reconciles_kept_outcomes_before_reporting_cleared():
|
||||
result = run_session("""
|
||||
const values = new Map();
|
||||
let items = [1,2].map(notification_id => ({notification_id}));
|
||||
const outcomes = [];
|
||||
const session = createSession({
|
||||
storage:{getItem:key=>values.get(key)||null,setItem:(key,value)=>values.set(key,value),removeItem:key=>values.delete(key)},
|
||||
getLogin:()=> 'timmy', getItems:()=>items,
|
||||
onOpen:()=>{}, onProgress:()=>{}, onFinish:value=>outcomes.push(value),
|
||||
});
|
||||
session.start();
|
||||
session.keepUnreadAndNext();
|
||||
items = [2].map(notification_id => ({notification_id}));
|
||||
session.completeAndNext();
|
||||
process.stdout.write(JSON.stringify(outcomes[0]));
|
||||
""")
|
||||
|
||||
assert result == {"reviewed": 2, "resolved": 2, "kept": 0, "keptIdentities": []}
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_dashboard_wires_resumable_updates_triage_mobile_flow():
|
||||
html = await dashboard()
|
||||
@@ -113,4 +160,8 @@ async def test_dashboard_wires_resumable_updates_triage_mobile_flow():
|
||||
assert "updateTriage.acceptCompleted()" in html
|
||||
assert "updateTriage.keepUnreadAndNext()" in html
|
||||
assert "updateTriage.reconcile()" in html
|
||||
assert 'id="mobile-update-outcome"' in html
|
||||
assert 'id="review-kept-updates"' in html
|
||||
assert "updateTriage.reviewKept(keptUpdateIdentities)" in html
|
||||
assert "showUpdateTriageOutcome(outcome)" in html
|
||||
assert ".update-triage-progress" in html
|
||||
Reference in new issue
Block a user