@@ -5,7 +5,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
55
66vi . unmock ( '@/stores/terminal' )
77vi . unmock ( '@/stores/terminal/console/store' )
8+ vi . unmock ( '@/stores/notifications' )
89
10+ import { useNotificationStore } from '@/stores/notifications'
911import { useTerminalConsoleStore } from '@/stores/terminal/console/store'
1012
1113describe ( 'terminal console store' , ( ) => {
@@ -17,6 +19,9 @@ describe('terminal console store', () => {
1719 isOpen : false ,
1820 _hasHydrated : true ,
1921 } )
22+ useNotificationStore . setState ( {
23+ notifications : [ ] ,
24+ } )
2025 } )
2126
2227 it ( 'normalizes oversized payloads when adding console entries' , ( ) => {
@@ -117,6 +122,37 @@ describe('terminal console store', () => {
117122 expect ( after . getWorkflowEntries ( 'wf-1' ) [ 0 ] . output ) . toMatchObject ( { status : 'updated' } )
118123 } )
119124
125+ it ( 'uses the block name from error updates in notifications' , ( ) => {
126+ useTerminalConsoleStore . getState ( ) . addConsole ( {
127+ workflowId : 'wf-1' ,
128+ blockId : 'block-1' ,
129+ blockName : 'Unknown Block' ,
130+ blockType : 'function' ,
131+ executionId : 'exec-1' ,
132+ executionOrder : 1 ,
133+ isRunning : true ,
134+ } )
135+
136+ useTerminalConsoleStore . getState ( ) . updateConsole (
137+ 'block-1' ,
138+ {
139+ blockName : 'Transform Data' ,
140+ blockType : 'function' ,
141+ executionOrder : 1 ,
142+ error : 'Boom' ,
143+ success : false ,
144+ } ,
145+ 'exec-1'
146+ )
147+
148+ const [ entry ] = useTerminalConsoleStore . getState ( ) . getWorkflowEntries ( 'wf-1' )
149+ const [ notification ] = useNotificationStore . getState ( ) . notifications
150+
151+ expect ( entry . blockName ) . toBe ( 'Transform Data' )
152+ expect ( notification . message ) . toBe ( 'Transform Data: Boom' )
153+ expect ( notification . action ?. message ) . toContain ( 'Error in Transform Data.' )
154+ } )
155+
120156 describe ( 'cancelRunningEntries' , ( ) => {
121157 it ( 'flips a plain running entry to canceled' , ( ) => {
122158 useTerminalConsoleStore . getState ( ) . addConsole ( {
0 commit comments