mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
test(jetbrains): drop stale branch lookups from dock assertions
SessionUiTestBase builds a SessionUi in setUp and never settles, so that UI's branch refresh is still queued when a test swaps in a FakeWorktreeRpcApi. The coroutine resolves KiloWorktreeService from inside the launch, so once the shared single-thread dispatcher reaches it after the swap it records a lookup on the fake -- with the GitHub flag read before the test changed the setting. That made the two branch-dock lookup tests fail intermittently in CI with an extra leading (/test, true) entry. Drain and discard those pre-swap lookups in the dock() helper so the assertions only see the UI under test. Verified by blocking the test dispatcher in setUp, which reproduces the exact CI failure without the fix and passes with it.
This commit is contained in:
+6
@@ -1237,6 +1237,12 @@ class SessionUiLayoutTest : SessionUiTestBase() {
|
||||
worktree = fake
|
||||
ApplicationManager.getApplication()
|
||||
.replaceService(KiloWorktreeService::class.java, KiloWorktreeService(scope, fake), testRootDisposable)
|
||||
// The UI built in setUp launched its own branch lookup before this fake existed, and it
|
||||
// resolves the service inside the coroutine — so it lands on the fake whenever the shared
|
||||
// dispatcher gets to it after the swap. Drain it here and drop what it recorded so the
|
||||
// assertions below only see the lookup made by the UI under test.
|
||||
settle()
|
||||
fake.branchCalls.clear()
|
||||
ui = newUi(manager = object : SessionManager {
|
||||
override fun newSession() {}
|
||||
override fun showHistory(back: (() -> Unit)?) {}
|
||||
|
||||
Reference in New Issue
Block a user