Improve chat session catalog creation

This commit is contained in:
2026-10-21 13:48:35 +01:00
parent f239a26bfd
commit a2b02b3810
5 changed files with 243 additions and 36 deletions
@@ -292,5 +292,25 @@ void main() {
expect(gateway.calls.single.fields['chat_query']['limit'], 200);
},
);
test(
'reads exact directory/backend catalog envelopes without inventing fallback',
() async {
gateway.reply = {
'chat_directories': ['~', '/work'],
};
expect(await repo.directories(), ['~', '/work']);
expect(gateway.calls.last.type, 'chat_directories');
expect(gateway.calls.last.fields, isEmpty);
gateway.reply = {
'chat_backends': ['opencode', 'claude'],
};
expect(await repo.backends(), ['opencode', 'claude']);
expect(gateway.calls.last.type, 'chat_backends');
expect(gateway.calls.last.fields, isEmpty);
gateway.reply = {};
await expectLater(repo.directories(), throwsStateError);
await expectLater(repo.backends(), throwsStateError);
},
);
});
}