@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.
- Functions:
boundaryProblems,exportedNames,freshState,loadChecked,partnerCases,play,undocumentedExports - Types:
PartnerCase
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/butsrc/react/, imports only@ifloom/engine,@ifloom/engine/pluginand its own files beside it, never its React UI. - It uses no browser global (
window.,document.) outside strings and comments. src/react/, the/reactsubpath, imports only the engine's main entry,react,react-dom,@ifloom/reactand@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): GameStateUses: 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): GameUses: 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
}| Field | Type | Optional | Default | Description |
|---|---|---|---|---|
name | string | The case's name for a test, alone or with <id>. | ||
partner | string | null | The partner's id, or null for the plugin alone. | ||
plugins | Plugin[] | The plugins to load, the partner first if there is one, then the plugin under test. | ||
has | (id: string) => boolean | Returns 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[]): GameStateUses: 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