@mantaq/test 0.0.2 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -26,17 +26,18 @@ interface CoverageReport {
26
26
  effects: number;
27
27
  };
28
28
  }
29
- interface TestHarness {
30
- actor: AnyActor;
29
+ interface TestHarness<C = Record<string, unknown>> {
30
+ actor: AnyActor<C>;
31
31
  graph: ActorGraph;
32
32
  history: History;
33
33
  coverage: () => CoverageReport;
34
34
  send(event: {
35
- id: string;
36
- } & Record<string, unknown>): void;
35
+ type: string;
36
+ payload?: unknown;
37
+ }): void;
37
38
  state: AnyActor["state"];
38
- snapshot(): Snapshot;
39
- context: Record<string, unknown> | undefined;
39
+ snapshot(): Snapshot<C>;
40
+ context: C | undefined;
40
41
  assertAllStatesVisited(): void;
41
42
  assertAllTransitionsVisited(): void;
42
43
  assertStateVisited(stateName: string): void;
@@ -55,7 +56,7 @@ interface TestHarness {
55
56
  }
56
57
  //#endregion
57
58
  //#region src/harness.d.ts
58
- declare function createTestHarness(actor: AnyActor): TestHarness;
59
+ declare function createTestHarness<C>(actor: AnyActor<C>): TestHarness<C>;
59
60
  //#endregion
60
61
  //#region src/coverage.d.ts
61
62
  declare function computeCoverage(graph: ActorGraph, history: History): CoverageReport;
@@ -67,7 +68,7 @@ declare function assertStateVisited(history: History, stateName: string): void;
67
68
  declare function assertStateNeverVisited(history: History, stateName: string): void;
68
69
  declare function assertTransitionVisited(history: History, from: string, event: string): void;
69
70
  declare function assertTransitionNeverVisited(history: History, from: string, event: string): void;
70
- declare function assertContextNever(actor: AnyActor, predicate: (context: unknown) => boolean): void;
71
+ declare function assertContextNever<C>(actor: AnyActor<C>, predicate: (context: unknown) => boolean): void;
71
72
  declare function assertEffectRan(history: History, stateName: string): void;
72
73
  declare function assertEffectNeverRan(history: History, stateName: string): void;
73
74
  declare function assertReachedState(history: History, stateName: string): void;
package/dist/index.mjs CHANGED
@@ -88,8 +88,8 @@ function assertNeverReachedState(history, stateName) {
88
88
  //#region src/harness.ts
89
89
  function createTestHarness(actor) {
90
90
  const instrumented = instrument(actor);
91
- const internalIds = new Set((actor.options?.internal ?? []).map((e) => e.id));
92
- const graph = buildGraph(actor, { internalIds });
91
+ const internalTypes = new Set((actor.options?.internal ?? []).map((e) => e.type));
92
+ const graph = buildGraph(actor, { internalIds: internalTypes });
93
93
  return {
94
94
  actor: instrumented,
95
95
  graph,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantaq/test",
3
- "version": "0.0.2",
3
+ "version": "0.1.1",
4
4
  "description": "Test harness and assertion utilities for verifying mantaq actor behavior.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -20,8 +20,8 @@
20
20
  "access": "public"
21
21
  },
22
22
  "dependencies": {
23
- "@mantaq/core": "0.0.2",
24
- "@mantaq/traversal": "0.0.2"
23
+ "@mantaq/core": "0.2.0",
24
+ "@mantaq/traversal": "0.1.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/node": "^26.2.0",