Skip to content

mockItems

Jason Godesky edited this page Aug 15, 2026 · 2 revisions

mockItems is a mock for a Collection of items (like game.items). The mock is rather bare, really only covering get.

Examples

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

const item = mockItem({ name: 'Test' })
const dict: Record<string, foundry.documents.Item> = {}
dict[getID(item.uuid)] = item
mockItems(dict)

Clone this wiki locally