test: deflake the suite — pumpEventQueue instead of Future.delayed(Duration.zero)
~173 `await Future<void>.delayed(Duration.zero)` async-settle waits across 25 test files yield the microtask queue exactly once; when an event→handler chain needs more than one hop they lose the race under CI's parallel load, so the failing set varied run to run. Replace with `await pumpEventQueue()` (the deterministic drain already used elsewhere in the suite); rewired the shared settle()/tick() helpers in one shot. menu_bar's toggle-close test gets a bounded extra pump. Verified green under CI=true. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -47,14 +47,14 @@ void main() {
|
||||
test('a load message loads the ticket', () async {
|
||||
c = TicketDetailController(ipc: f.ipc, messages: f.services.messages);
|
||||
f.services.messages.publish('builtin.tickets', 'load', {'id': 'T-1'});
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
await pumpEventQueue();
|
||||
expect(c!.detail?.id, 'T-1');
|
||||
});
|
||||
|
||||
test('a bare selection does NOT load (the nav re-emits as load)', () async {
|
||||
c = TicketDetailController(ipc: f.ipc, messages: f.services.messages);
|
||||
f.services.messages.publish('builtin.tickets', 'selection', {'id': 'T-9'});
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
await pumpEventQueue();
|
||||
expect(c!.detail, isNull);
|
||||
});
|
||||
});
|
||||
@@ -78,9 +78,9 @@ void main() {
|
||||
|
||||
test('selection reveals + activates the static detail tab without churn', () async {
|
||||
f.services.messages.publish('builtin.tickets', 'selection', {'id': 'T-1'});
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
await pumpEventQueue();
|
||||
f.services.messages.publish('builtin.tickets', 'selection', {'id': 'T-2'});
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
await pumpEventQueue();
|
||||
expect(f.services.panels.activeTabIn(Slots.contextPanel), 'tickets.detail');
|
||||
expect(f.services.panels.tabsFor(Slots.contextPanel).where((t) => t.id == 'tickets.detail').length, 1);
|
||||
expect(f.services.arrangement.isVisible(Slots.contextPanel), isTrue);
|
||||
|
||||
Reference in New Issue
Block a user