You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jason Godesky edited this page Aug 2, 2026
·
1 revision
mockHooks mocks Foundry’s Hooks class to help you test your hooks.
Examples
import{describe,it,expect}from'vitest'import{mockHooks}from'@revolutionarygamesco/common-foundryvtt/mocks'describe('testRun',()=>{it('runs the hook',()=>{consthooks=mockHooks()Hooks.on('someEvent',(a: number)=>{})Hooks.call('someEvent',42)expect(hooks.call).toHaveBeenCalledWith('someEvent',42)})})