Skip to content

@vttforge/testing / MockFoundry

Interface: MockFoundry

Properties

enrichers

readonly enrichers: readonly RecordedEnricher[]

Every text enricher registered, in order.

id is namespaced, which is what stops a common name from colliding with another package, and what makes onRender fire at all.


hooks

readonly hooks: readonly RecordedHook[]

Every Hooks.on and Hooks.once, in order.


notifications

readonly notifications: readonly object[]

Every notification raised, by severity.


settings

readonly settings: readonly RecordedSetting[]

Every game.settings.register, in order.


sheets

readonly sheets: readonly RecordedSheet[]

Every sheet registered, in order.

key is the thing worth asserting: Foundry saves it on each document using the sheet, so a test that pins the key is a test that the reader's choice survives your next build.

Methods

callHook()

callHook(event, ...args): unknown[]

Fire a hook the way Foundry would, for the listeners registered so far.

Parameters

event

string

args

...unknown[]

Returns

unknown[]


getSetting()

getSetting(namespace, key): unknown

Read back a registered setting's current value.

Parameters

namespace

string

key

string

Returns

unknown


restore()

restore(): void

Put every global back the way it was.

Returns

void

MIT licensed.