44
55import { omit } from '@sim/utils/object'
66import type { BlockState , WorkflowState } from '@sim/workflow-types/workflow'
7- import { afterAll , describe , expect , it , vi } from 'vitest'
7+ import { afterAll , beforeEach , describe , expect , it , type MockInstance , vi } from 'vitest'
88
99vi . unmock ( '@/blocks/registry' )
1010
@@ -16,7 +16,10 @@ import * as blocksBarrel from '@/blocks'
1616import { getBlock as getRealBlock } from '@/blocks/registry'
1717import { extractBlockParams } from '@/serializer'
1818
19- const getBlockSpy = vi . spyOn ( blocksBarrel , 'getBlock' ) . mockImplementation ( getRealBlock )
19+ let getBlockSpy : MockInstance < typeof blocksBarrel . getBlock >
20+ beforeEach ( ( ) => {
21+ getBlockSpy = vi . spyOn ( blocksBarrel , 'getBlock' ) . mockImplementation ( getRealBlock )
22+ } )
2023
2124afterAll ( ( ) => {
2225 getBlockSpy . mockRestore ( )
@@ -71,7 +74,13 @@ describe('projectLegacySlackV2Auth', () => {
7174
7275 it ( 'honors the historical custom-bot and OAuth modes' , ( ) => {
7376 const historical = createHistoricalSlackV2Block ( )
74- historical . data ! . canonicalModes ! . botCredential = 'advanced'
77+ historical . data = {
78+ ...historical . data ,
79+ canonicalModes : {
80+ ...historical . data ?. canonicalModes ,
81+ botCredential : 'advanced' ,
82+ } ,
83+ }
7584 historical . subBlocks . manualCustomBotCredential . value = 'credential-manual-bot'
7685
7786 const projected = projectLegacySlackV2Auth ( { [ historical . id ] : historical } ) [ historical . id ]
0 commit comments