@vttforge/testing / MockFoundryOptions
Interface: MockFoundryOptions
Properties
foundry?
optionalfoundry?:Record<string,unknown>
Extra foundry.* members, merged over the defaults.
game?
optionalgame?:Record<string,unknown>
Extra game.* members, merged over the defaults.
globals?
optionalglobals?:Record<string,unknown>
Any other globals your code reads, installed for the life of the mock and removed by restore() along with the rest.
Foundry puts each document class on the global scope, and code under test reaches for them by name: Actor.create, JournalEntry.create, ChatMessage.getSpeaker. Those are not part of the fixed set this helper installs, so name the ones you need.
withMockFoundry({
globals: { JournalEntry: { create: vi.fn() } },
});user?
optionaluser?:object
The current user. Defaults to a GM, since most module code checks.
id?
optionalid?:string
isGM?
optionalisGM?:boolean
name?
optionalname?:string