Skip to content

Commit 378abb0

Browse files
waleedlatif1claude
andcommitted
test(terminal): capture store logger by label, not first warn-bearing mock
The previous capture used `.find` over all createLogger results, which returned whichever module created a logger first — not the store's logger — causing the legacy-keying warn assertion to see 0 calls. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 2854944 commit 378abb0

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

apps/sim/stores/terminal/console/store.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ vi.unmock('@/stores/terminal/console/store')
99

1010
import { useTerminalConsoleStore } from '@/stores/terminal/console/store'
1111

12-
const storeLogger = vi
12+
const storeLoggerCallIdx = vi
1313
.mocked(createLogger)
14-
.mock.results.map((result) => result.value)
15-
.find((value) => value && typeof value.warn === 'function')
14+
.mock.calls.findIndex((call) => call[0] === 'TerminalConsoleStore')
15+
const storeLogger =
16+
storeLoggerCallIdx >= 0
17+
? vi.mocked(createLogger).mock.results[storeLoggerCallIdx]?.value
18+
: undefined
1619

1720
describe('terminal console store', () => {
1821
beforeEach(() => {

0 commit comments

Comments
 (0)