@@ -23,11 +23,15 @@ vi.mock('../../../utils', async () => {
2323 } ;
2424} ) ;
2525
26- // Mock the actions
27- vi . mock ( './actions' , ( ) => ( {
28- readMigrationFiles : vi . fn ( ) ,
29- getMigrationFunction : vi . fn ( ) ,
30- } ) ) ;
26+ // Mock actions
27+ vi . mock ( './actions' , async ( ) => {
28+ const actual = await vi . importActual < typeof import ( './actions' ) > ( './actions' ) ;
29+ return {
30+ applyMigrationToAllBlocks : actual . applyMigrationToAllBlocks ,
31+ readMigrationFiles : vi . fn ( ) ,
32+ getMigrationFunction : vi . fn ( ) ,
33+ } ;
34+ } ) ;
3135
3236vi . mock ( '../../stories/actions' , ( ) => ( {
3337 fetchStories : vi . fn ( ) ,
@@ -170,16 +174,12 @@ describe('migrations run command - streaming approach', () => {
170174 // Verify that getMigrationFunction was called
171175 expect ( getMigrationFunction ) . toHaveBeenCalledWith ( 'migration-component.js' , '12345' , undefined ) ;
172176
173- // In the new streaming approach, updateStory is only called if the migration actually changes content
174- // Since our mock migration function doesn't actually change the content hash, updateStory won't be called
175- // This is the correct behavior - only stories with actual changes should be updated
176-
177177 // Verify that progress bars were displayed (konsola.info should be called for summaries)
178178 expect ( konsola . info ) . toHaveBeenCalledWith (
179179 expect . stringContaining ( 'Migration Results:' ) ,
180180 ) ;
181181 expect ( konsola . info ) . toHaveBeenCalledWith (
182- expect . stringContaining ( 'No stories required updates ' ) ,
182+ expect . stringContaining ( 'Update Results: 1 stories updated. ' ) ,
183183 ) ;
184184 } ) ;
185185
@@ -309,6 +309,9 @@ describe('migrations run command - streaming approach', () => {
309309 // Verify that getMigrationFunction was called
310310 expect ( getMigrationFunction ) . toHaveBeenCalledWith ( 'migration-component.js' , '12345' , undefined ) ;
311311
312+ expect ( konsola . warn ) . toHaveBeenCalledWith (
313+ expect . stringContaining ( 'DRY RUN MODE ENABLED: No changes will be made.' ) ,
314+ ) ;
312315 // Verify that updateStory was NOT called (since it's a dry run)
313316 expect ( updateStory ) . not . toHaveBeenCalled ( ) ;
314317
0 commit comments