Skip to content

API reference / @jsprismarine/entity-goals / GoalHarness

Class: GoalHarness ​

Defined in: harness.ts:172

One entity with the vanilla goals registered, its scheduler, and recording doubles behind both seams.

It builds a real EntityInstance from a real definition, so a test exercises the component parsing, the goal wrapper and the scheduler rather than a goal object in isolation.

Constructors ​

Constructor ​

new GoalHarness(options): GoalHarness

Defined in: harness.ts:179

Parameters ​

options ​

GoalHarnessOptions

Returns ​

GoalHarness

Properties ​

actuator ​

readonly actuator: RecordingActuator

Defined in: harness.ts:177

What the goals did to the entity.


entity ​

readonly entity: EntityInstance

Defined in: harness.ts:174

The live entity, whose goals scheduler the harness ticks.

Methods ​

holderOf() ​

holderOf(flag): string | undefined

Defined in: harness.ts:236

Which goal holds a control flag now.

Parameters ​

flag ​

"move" | "look" | "jump"

Returns ​

string | undefined


isRunning() ​

isRunning(name): boolean

Defined in: harness.ts:241

Whether a goal is running now.

Parameters ​

name ​

string

Returns ​

boolean


running() ​

running(): readonly string[]

Defined in: harness.ts:231

The goals running now, in priority order.

Returns ​

readonly string[]


tick() ​

tick(count?): void

Defined in: harness.ts:226

Runs the scheduler the given number of ticks.

Parameters ​

count? ​

number = 1

Returns ​

void