Skip to content

mockDocument

Jason Godesky edited this page Aug 15, 2026 · 1 revision

mockDocument is a method designed to make it easy to create fake documents for testing. mockActor, mockItem, and mockJournalEntry are made using this, so you may want to use one of them instead. This is exposed for other cases.

Examples

import { beforeEach, afterEach, describe, expect, it, vi } from 'vitest'
import { mockDocument } from '@revolutionarygamesco/common-foundryvtt/mocks'

const mockActor = (
  overrides?: Partial<foundry.documents.Actor>
): foundry.documents.Actor => {
  return mockDocument<foundry.documents.Actor>('Actor', overrides)
}

Clone this wiki locally