test('command choice continues with values rather than a full canned example',()=>{constrows=suggest('/ti',3);assert.equal(rows.find(r=>r.label==='/tid').value,'/tid ');assert.ok(suggest('/tid ',5).some(r=>r.value==='30m '));});
test('completion follows time category and description',()=>{assert.ok(suggest('/tid 30m re',11).some(r=>r.value==='research '));assert.ok(suggest('/tid 30m research ',18).some(r=>r.value==='"" '&&r.caret===1));});
test('employee completion filters initials and uses an unambiguous identifier',()=>{constrow=suggest('/tildel ct',10,{users})[0];assert.equal(row.label,'Christian Thomas');assert.equal(row.value,'ct ');});
test('subcase groups, dates and todo employee choices',()=>{assert.equal(suggest('//gruppe Sup',12,{groups:[{name:'Support'}]})[0].value,'"Support" ');assert.equal(suggest('/udsat i m',10)[0].value,'i morgen');assert.equal(suggest('/todo "Bestil" @ct',18,{users})[0].value,'@ct ');});
test('text commands insert quotes with the caret between them, including child scope',()=>{for(constprefixof['/','//'])for(constnameof['todo','undersag','note','mail','løsning']){constrow=suggest(prefix+name,(prefix+name).length).find(r=>r.label===prefix+name);assert.equal(row.value,prefix+name+' ""');assert.equal(row.value[row.caret-1],'"');assert.equal(row.value[row.caret],'"');}});
test('child assignment inserts initials, never the numeric user ID',()=>{constrow=suggest('//tildel ct',11,{users})[0];assert.equal(row.value,'ct ');});
test('duplicate initials use a unique username',()=>{constpeople=[...users,{user_id:4,username:'carlt',full_name:'Carl Thomsen'}];constrow=suggest('/tildel Carl',12,{users:people})[0];assert.equal(row.value,'carlt ');});