Skip to content

mockCollection

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

mockCollection is a mock for Collections. The mock is rather bare, really only covering get. mockActors, mockItems, and mockJournal are all created using mockCollection, so you may want to use one of those. This method is exposed to allow for other mocks.

Examples

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

const mockActors = (
  documents: CollectionRecord<foundry.documents.Actor> = {}
): void => { mockCollection('game.actors', documents) }

Clone this wiki locally