Early development: IFLoom can change until 1.0. What's stable
IFLoom

@ifloom/engine/testing

Every export of @ifloom/engine/testing, the engine's test helpers: its signature and its fields.

Generated from the source of @ifloom/engine/testing and its TSDoc by npm run api-docs. Each export links to the page that explains it, where one does.

boundaryProblems

Function. Explained in Testing helpers.

Returns one line for each break of the plugin rules in a plugin package's source, or none. Give each file's text by its path, any path with src/ in it, such as a glob's keys.

  • The main entry, everything in src/ but src/react/, imports only @ifloom/engine, @ifloom/engine/plugin and its own files beside it, never its React UI.
  • It uses no browser global (window., document.) outside strings and comments.
  • src/react/, the /react subpath, imports only the engine's main entry, react, react-dom, @ifloom/react and @ifloom/react/kit, its own files and ../index.ts.
import { boundaryProblems } from '@ifloom/engine/testing'
function boundaryProblems(sources: Readonly<Record<string, string>>): string[]

exportedNames

Function. Explained in Testing helpers.

Returns the names a source exports, sorted, from its export function, const, type and the rest, and each export list.

import { exportedNames } from '@ifloom/engine/testing'
function exportedNames(source: string): string[]

freshState

Function. Explained in Testing helpers.

Returns a new game's state from startingState with no scene open, so the room shows a plugin's actions and panels.

import { freshState } from '@ifloom/engine/testing'
function freshState(game: Game, options?: StartOptions): GameState

Uses: Game, StartOptions, GameState.

loadChecked

Function. Explained in Testing helpers.

Returns the game loadGame builds, for a test. It throws an Error listing every problem the content checker finds.

import { loadChecked } from '@ifloom/engine/testing'
function loadChecked(content: readonly Content[], base: GameBase, options?: LoadOptions): Game

Uses: Content, GameBase, LoadOptions, Game.

PartnerCase

Type. Explained in Testing helpers.

One way to load a plugin for a test, alone or with one of the plugins it cooperates with.

import type { PartnerCase } from '@ifloom/engine/testing'
type PartnerCase = {
  name: string
  partner: string | null
  plugins: Plugin[]
  has: (id: string) => boolean
}
FieldTypeOptionalDefaultDescription
namestringThe case's name for a test, alone or with <id>.
partnerstring | nullThe partner's id, or null for the plugin alone.
pluginsPlugin[]The plugins to load, the partner first if there is one, then the plugin under test.
has(id: string) => booleanReturns true when the case loads the plugin id, the plugin under test or the partner.

partnerCases

Function. Explained in Testing helpers.

Returns the PartnerCases of a plugin, alone and then with each partner in turn, for a test to run in each. It throws for a partner missing from cooperates or listed twice.

import { partnerCases } from '@ifloom/engine/testing'
function partnerCases(plugin: Plugin, partners: readonly Plugin[]): PartnerCase[]

Uses: Plugin, PartnerCase.

play

Function. Explained in Testing helpers.

Returns the state after each command in turn. It throws on the first command refused, naming it and the reason.

import { play } from '@ifloom/engine/testing'
function play(state: GameState, game: Game, ...commands: readonly CommandRef[]): GameState

Uses: GameState, Game, CommandRef.

undocumentedExports

Function. Explained in Testing helpers.

Returns the names the entries' sources export that a docs page never mentions as a word, sorted.

import { undocumentedExports } from '@ifloom/engine/testing'
function undocumentedExports(sources: readonly string[], page: string): string[]

Last updated on

On this page