@flighthq/statechart 0.5.1-next.920.da8f530 → 0.6.0

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.
Files changed (66) hide show
  1. package/README.md +2 -2
  2. package/dist/.tsbuildinfo.contract +1 -0
  3. package/dist/.tsbuildinfo.runtime +1 -0
  4. package/dist/contract.d.ts +7 -4
  5. package/dist/contract.d.ts.map +1 -1
  6. package/dist/contract.js +8 -4
  7. package/dist/contract.js.map +1 -1
  8. package/dist/contract.statechart-types.d.ts +3 -0
  9. package/dist/contract.statechart-types.d.ts.map +1 -0
  10. package/dist/contract.statechart-types.js +4 -0
  11. package/dist/contract.statechart-types.js.map +1 -0
  12. package/dist/enableStatechartGuards.d.ts +5 -4
  13. package/dist/enableStatechartGuards.d.ts.map +1 -1
  14. package/dist/enableStatechartGuards.js +11 -4
  15. package/dist/enableStatechartGuards.js.map +1 -1
  16. package/dist/index.d.ts +3 -3
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +4 -3
  19. package/dist/index.js.map +1 -1
  20. package/dist/statechart.d.ts +13 -12
  21. package/dist/statechart.d.ts.map +1 -1
  22. package/dist/statechart.js +302 -263
  23. package/dist/statechart.js.map +1 -1
  24. package/dist/statechartCompat.d.ts +46 -0
  25. package/dist/statechartCompat.d.ts.map +1 -0
  26. package/dist/statechartCompat.js +127 -0
  27. package/dist/statechartCompat.js.map +1 -0
  28. package/dist/statechartInstanceFields.d.ts +3 -0
  29. package/dist/statechartInstanceFields.d.ts.map +1 -0
  30. package/dist/statechartInstanceFields.js +13 -0
  31. package/dist/statechartInstanceFields.js.map +1 -0
  32. package/dist/statechartInstanceInit.d.ts +4 -0
  33. package/dist/statechartInstanceInit.d.ts.map +1 -0
  34. package/dist/statechartInstanceInit.js +7 -0
  35. package/dist/statechartInstanceInit.js.map +1 -0
  36. package/dist/statechartRuntime.d.ts +9 -0
  37. package/dist/statechartRuntime.d.ts.map +1 -0
  38. package/dist/statechartRuntime.js +25 -0
  39. package/dist/statechartRuntime.js.map +1 -0
  40. package/dist/statechartSignalEmit.d.ts +3 -0
  41. package/dist/statechartSignalEmit.d.ts.map +1 -0
  42. package/dist/statechartSignalEmit.js +7 -0
  43. package/dist/statechartSignalEmit.js.map +1 -0
  44. package/dist/statechartSignals.d.ts +4 -3
  45. package/dist/statechartSignals.d.ts.map +1 -1
  46. package/dist/statechartSignals.js +2 -2
  47. package/dist/statechartSignals.js.map +1 -1
  48. package/dist/statechartTypedArrays.d.ts +4 -0
  49. package/dist/statechartTypedArrays.d.ts.map +1 -0
  50. package/dist/statechartTypedArrays.js +10 -0
  51. package/dist/statechartTypedArrays.js.map +1 -0
  52. package/dist/types.d.ts +85 -0
  53. package/dist/types.d.ts.map +1 -0
  54. package/dist/types.js +33 -0
  55. package/dist/types.js.map +1 -0
  56. package/package.json +7 -6
  57. package/src/enableStatechartGuards.test.ts +26 -17
  58. package/src/statechart.test.ts +434 -291
  59. package/src/statechartCompat.test.ts +165 -0
  60. package/src/statechartInstanceFields.test.ts +36 -0
  61. package/src/statechartInstanceInit.test.ts +20 -0
  62. package/src/statechartIntegerDomain.test.ts +57 -0
  63. package/src/statechartRuntime.test.ts +55 -0
  64. package/src/statechartSignalEmit.test.ts +19 -0
  65. package/src/statechartSignals.test.ts +9 -9
  66. package/src/statechartTypedArrays.test.ts +25 -0
@@ -0,0 +1,165 @@
1
+ import { Entity } from '@flighthq/entity/contract';
2
+ import { createLogState } from '@flighthq/log/contract';
3
+ import { connectSignal } from '@flighthq/signals/contract';
4
+
5
+ import {
6
+ createStatechartInstance,
7
+ getStatechartInputIndex,
8
+ getStatechartRegionBlend,
9
+ getStatechartRegionState,
10
+ } from './statechart.ts';
11
+ import { Statechart, StatechartInstance } from './statechartCompat.ts';
12
+ import { StatechartAtomicStateKind, StatechartInputKind, StatechartTransitionStatus } from './types.ts';
13
+ import type { StatechartRaw } from './types.ts';
14
+
15
+ describe('Statechart', () => {
16
+ it('provides class-correct constructor and create defaults compatible with Entity', () => {
17
+ const constructed = new Statechart();
18
+ const created = Statechart.create();
19
+ const entityClass: typeof Entity = Statechart;
20
+ const baseCreated = entityClass.create();
21
+
22
+ expect(constructed).toBeInstanceOf(Statechart);
23
+ expect(constructed.raw).toEqual({ inputs: [], regions: [] });
24
+ expect(created).toBeInstanceOf(Statechart);
25
+ expect(created.raw).toEqual({ inputs: [], regions: [] });
26
+ expect(baseCreated).toBeInstanceOf(Statechart);
27
+ expectTypeOf(constructed).toEqualTypeOf<Statechart>();
28
+ expectTypeOf(created).toEqualTypeOf<Statechart>();
29
+ expectTypeOf(baseCreated).toEqualTypeOf<Entity>();
30
+ });
31
+
32
+ it('returns one stable typed wrapper without replacing the authored graph identity', () => {
33
+ const raw = chart();
34
+ const wrapper = Statechart.from(raw);
35
+
36
+ expect(wrapper.raw).toBe(raw);
37
+ expect(Statechart.from(raw)).toBe(wrapper);
38
+ expect(Entity.from(raw)).toBe(wrapper);
39
+ expect(wrapper.inputs).toBe(raw.inputs);
40
+ expect(wrapper.regions).toBe(raw.regions);
41
+ expect(wrapper.name).toBe(raw.name);
42
+ expect(wrapper.getInputIndex('speed')).toBe(getStatechartInputIndex(raw, 'speed'));
43
+ });
44
+
45
+ it('rejects generic-first and incompatible typed-wrapper collisions', () => {
46
+ const genericRaw = chart();
47
+ const generic = Entity.from(genericRaw);
48
+
49
+ expect(() => Statechart.from(genericRaw)).toThrow(
50
+ new TypeError('StatechartRaw is already attached to an incompatible OOP wrapper'),
51
+ );
52
+ expect(Entity.from(genericRaw)).toBe(generic);
53
+
54
+ const typedRaw = chart();
55
+ const other = new OtherEntity(typedRaw);
56
+ expect(() => Statechart.from(typedRaw)).toThrow(TypeError);
57
+ expect(Entity.from(typedRaw)).toBe(other);
58
+ });
59
+ });
60
+
61
+ describe('StatechartInstance', () => {
62
+ it('provides class-correct constructor and create defaults compatible with Entity', () => {
63
+ const constructed = new StatechartInstance();
64
+ const created = StatechartInstance.create();
65
+ const entityClass: typeof Entity = StatechartInstance;
66
+ const baseCreated = entityClass.create();
67
+
68
+ expect(constructed).toBeInstanceOf(StatechartInstance);
69
+ expect(constructed.raw.chart).toEqual({ inputs: [], regions: [] });
70
+ expect(created).toBeInstanceOf(StatechartInstance);
71
+ expect(created.raw.chart).toEqual({ inputs: [], regions: [] });
72
+ expect(baseCreated).toBeInstanceOf(StatechartInstance);
73
+ expectTypeOf(constructed).toEqualTypeOf<StatechartInstance>();
74
+ expectTypeOf(created).toEqualTypeOf<StatechartInstance>();
75
+ expectTypeOf(baseCreated).toEqualTypeOf<Entity>();
76
+ });
77
+
78
+ it('returns one stable typed wrapper without replacing the raw actor identity', () => {
79
+ const raw = createStatechartInstance(chart());
80
+ const wrapper = StatechartInstance.from(raw);
81
+
82
+ expect(wrapper.raw).toBe(raw);
83
+ expect(StatechartInstance.from(raw)).toBe(wrapper);
84
+ expect(Entity.from(raw)).toBe(wrapper);
85
+ });
86
+
87
+ it('rejects generic-first and incompatible typed-wrapper collisions', () => {
88
+ const genericRaw = createStatechartInstance(chart());
89
+ const generic = Entity.from(genericRaw);
90
+
91
+ expect(() => StatechartInstance.from(genericRaw)).toThrow(
92
+ new TypeError('StatechartInstanceRaw is already attached to an incompatible OOP wrapper'),
93
+ );
94
+ expect(Entity.from(genericRaw)).toBe(generic);
95
+
96
+ const typedRaw = createStatechartInstance(chart());
97
+ const other = new OtherEntity(typedRaw);
98
+ expect(() => StatechartInstance.from(typedRaw)).toThrow(TypeError);
99
+ expect(Entity.from(typedRaw)).toBe(other);
100
+ });
101
+
102
+ it('delegates method sugar and buffer access to the same raw actor as the free functions', () => {
103
+ const definition = Statechart.from(chart());
104
+ const instance = StatechartInstance.create(definition);
105
+
106
+ expect(instance.chart).toBe(definition.raw);
107
+ expect(instance.inputValues).toBe(instance.raw.inputValues);
108
+ expect(instance.regionBlendValues).toBe(instance.raw.regionBlend);
109
+ expect(instance.regionDuration).toBe(instance.raw.regionDuration);
110
+ expect(instance.regionElapsed).toBe(instance.raw.regionElapsed);
111
+ expect(instance.regionStates).toBe(instance.raw.regionStates);
112
+ expect(instance.regionTransitions).toBe(instance.raw.regionTransitions);
113
+ expect(instance.regionBlend(0)).toBe(getStatechartRegionBlend(instance.raw, 0));
114
+ expect(instance.regionState(0)).toBe(getStatechartRegionState(instance.raw, 0));
115
+
116
+ instance.setNumberInput(0, 4);
117
+ instance.fireTrigger(1);
118
+ instance.setBooleanInput(2, true);
119
+ instance.setRegionDuration(0, 100);
120
+ expect(Array.from(instance.inputValues)).toEqual([4, 1, 1]);
121
+ expect(instance.regionDuration[0]).toBe(100);
122
+ expect(instance.explainTransition(0).status).toBe(StatechartTransitionStatus.Ready);
123
+
124
+ const received: number[][] = [];
125
+ const signals = instance.enableSignals();
126
+ connectSignal(signals.onStateChange, (payload) => received.push([...payload]));
127
+ expect(instance.getSignals()).toBe(signals);
128
+ expect(instance.signals).toBe(signals);
129
+
130
+ const logState = createLogState();
131
+ instance.enableGuards(logState, () => 0);
132
+ expect(instance.guardsEnabled()).toBe(true);
133
+ instance.disableGuards();
134
+ expect(instance.guardsEnabled()).toBe(false);
135
+
136
+ expect(instance.advance(0)).toBe(1);
137
+ expect(instance.regionState(0)).toBe(1);
138
+ expect(received).toEqual([[0, 0, 1]]);
139
+ });
140
+ });
141
+
142
+ class OtherEntity extends Entity {}
143
+
144
+ function chart(): StatechartRaw {
145
+ return {
146
+ inputs: [
147
+ { initialValue: 0, kind: StatechartInputKind.Number, name: 'speed' },
148
+ { initialValue: 0, kind: StatechartInputKind.Trigger, name: 'go' },
149
+ { initialValue: 0, kind: StatechartInputKind.Boolean, name: 'enabled' },
150
+ ],
151
+ name: 'Test',
152
+ regions: [
153
+ {
154
+ initialStateIndex: 0,
155
+ states: [
156
+ {
157
+ kind: StatechartAtomicStateKind,
158
+ transitions: [{ conditions: [], durationMs: 0, exitTimeRatio: -1, targetStateIndex: 1 }],
159
+ },
160
+ { kind: StatechartAtomicStateKind, transitions: [] },
161
+ ],
162
+ },
163
+ ],
164
+ };
165
+ }
@@ -0,0 +1,36 @@
1
+ import { allocateEntity } from '@flighthq/entity/contract';
2
+ import { describe, expect, it } from 'vitest';
3
+
4
+ import { initializeStatechartInstanceFields } from './statechartInstanceFields.ts';
5
+ import type { StatechartInstanceRaw, StatechartRaw } from './types.ts';
6
+
7
+ describe('initializeStatechartInstanceFields', () => {
8
+ it('installs caller-owned buffers and clears nullable runtime slots', () => {
9
+ const out = allocateEntity<StatechartInstanceRaw>();
10
+ const chart: StatechartRaw = { inputs: [], regions: [] };
11
+ const inputValues = new Float64Array(1);
12
+ const regionBlend = new Float32Array(1);
13
+ const regionDuration = new Float64Array(1);
14
+ const regionElapsed = new Float64Array(1);
15
+ const regionStates = new Int32Array([2]);
16
+ const regionTransitions = new Int32Array([-1]);
17
+
18
+ initializeStatechartInstanceFields(
19
+ out as StatechartInstanceRaw,
20
+ chart,
21
+ inputValues,
22
+ regionBlend,
23
+ regionDuration,
24
+ regionElapsed,
25
+ regionStates,
26
+ regionTransitions,
27
+ );
28
+
29
+ expect(out.chart).toBe(chart);
30
+ expect(out.inputValues).toBe(inputValues);
31
+ expect(out.regionStates).toBe(regionStates);
32
+ expect(out.regionTransitions).toBe(regionTransitions);
33
+ expect(out.durationGuard).toBeNull();
34
+ expect(out.signals).toBeNull();
35
+ });
36
+ });
@@ -0,0 +1,20 @@
1
+ import { allocateEntity } from '@flighthq/entity/contract';
2
+ import { describe, expect, it } from 'vitest';
3
+
4
+ import { initializeStatechartInstance } from './statechartInstanceInit.ts';
5
+ import { StatechartAtomicStateKind } from './types.ts';
6
+ import type { StatechartInstanceRaw, StatechartRaw } from './types.ts';
7
+
8
+ describe('initializeStatechartInstance', () => {
9
+ it('initializes caller-allocated state and nullable slots', () => {
10
+ const chart: StatechartRaw = {
11
+ inputs: [],
12
+ regions: [{ initialStateIndex: 0, states: [{ kind: StatechartAtomicStateKind, transitions: [] }] }],
13
+ };
14
+ const out = allocateEntity<StatechartInstanceRaw>();
15
+ initializeStatechartInstance(out, chart);
16
+ expect(out.chart).toBe(chart);
17
+ expect(out.durationGuard).toBeNull();
18
+ expect(out.signals).toBeNull();
19
+ });
20
+ });
@@ -0,0 +1,57 @@
1
+ import { createStatechartInstance, getStatechartRegionBlend, getStatechartRegionState } from './statechart.ts';
2
+ import { StatechartAtomicStateKind } from './types.ts';
3
+ import type { StatechartRaw } from './types.ts';
4
+
5
+ describe('Statechart integer domain', () => {
6
+ it('rejects a fractional authored initialStateIndex', () => {
7
+ const raw = chart();
8
+ raw.regions[0]!.initialStateIndex = 0.5;
9
+
10
+ expect(() => createStatechartInstance(raw)).toThrow(RangeError);
11
+ });
12
+
13
+ it('rejects a fractional authored targetStateIndex', () => {
14
+ const raw = chart();
15
+ raw.regions[0]!.states[0]!.transitions[0]!.targetStateIndex = 0.5;
16
+
17
+ expect(() => createStatechartInstance(raw)).toThrow(RangeError);
18
+ });
19
+
20
+ it('returns the blend sentinel for a fractional region index', () => {
21
+ const instance = createStatechartInstance(chart());
22
+
23
+ expect(getStatechartRegionBlend(instance, 0.5)).toBe(-1);
24
+ });
25
+
26
+ it('returns the state sentinel for a fractional region index', () => {
27
+ const instance = createStatechartInstance(chart());
28
+
29
+ expect(getStatechartRegionState(instance, 0.5)).toBe(-1);
30
+ });
31
+ });
32
+
33
+ function chart(): Mutable<StatechartRaw> {
34
+ return {
35
+ inputs: [],
36
+ regions: [
37
+ {
38
+ initialStateIndex: 0,
39
+ states: [
40
+ {
41
+ kind: StatechartAtomicStateKind,
42
+ transitions: [{ conditions: [], durationMs: 0, exitTimeRatio: -1, targetStateIndex: 1 }],
43
+ },
44
+ { kind: StatechartAtomicStateKind, transitions: [] },
45
+ ],
46
+ },
47
+ ],
48
+ };
49
+ }
50
+
51
+ type Mutable<Type> = {
52
+ -readonly [Key in keyof Type]: Type[Key] extends readonly (infer Item)[]
53
+ ? Mutable<Item>[]
54
+ : Type[Key] extends object
55
+ ? Mutable<Type[Key]>
56
+ : Type[Key];
57
+ };
@@ -0,0 +1,55 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import {
4
+ isStatechartComparison,
5
+ isStatechartInteger,
6
+ isStatechartString,
7
+ throwStatechartInputKindTypeError,
8
+ throwStatechartTypeError,
9
+ throwStatechartUnknownInputKindTypeError,
10
+ } from './statechartRuntime.ts';
11
+ import { StatechartComparison, StatechartInputKind } from './types.ts';
12
+
13
+ describe('isStatechartComparison', () => {
14
+ it('accepts only the public comparison vocabulary', () => {
15
+ expect(isStatechartComparison(StatechartComparison.Equal)).toBe(true);
16
+ expect(isStatechartComparison('Unknown' as StatechartComparison)).toBe(false);
17
+ });
18
+ });
19
+
20
+ describe('isStatechartInteger', () => {
21
+ it('rejects fractional JavaScript indices', () => {
22
+ expect(isStatechartInteger(1)).toBe(true);
23
+ expect(isStatechartInteger(0.5)).toBe(false);
24
+ });
25
+ });
26
+
27
+ describe('isStatechartString', () => {
28
+ it('rejects non-string values at the TypeScript boundary', () => {
29
+ expect(isStatechartString('Statechart.Custom')).toBe(true);
30
+ expect(isStatechartString(1 as unknown as string)).toBe(false);
31
+ });
32
+ });
33
+
34
+ describe('throwStatechartInputKindTypeError', () => {
35
+ it('preserves known and malformed JavaScript values in mismatch diagnostics', () => {
36
+ expect(() =>
37
+ throwStatechartInputKindTypeError(2, 'Unknown' as StatechartInputKind, StatechartInputKind.Boolean),
38
+ ).toThrow('Statechart input 2 is Unknown, not Boolean');
39
+ });
40
+ });
41
+
42
+ describe('throwStatechartTypeError', () => {
43
+ it('preserves the public TypeError class and message', () => {
44
+ expect(() => throwStatechartTypeError('invalid statechart')).toThrow(TypeError);
45
+ expect(() => throwStatechartTypeError('invalid statechart')).toThrow('invalid statechart');
46
+ });
47
+ });
48
+
49
+ describe('throwStatechartUnknownInputKindTypeError', () => {
50
+ it('preserves malformed JavaScript values in construction diagnostics', () => {
51
+ expect(() => throwStatechartUnknownInputKindTypeError(1, 'Unknown' as StatechartInputKind)).toThrow(
52
+ 'Statechart input 1 has unknown kind Unknown',
53
+ );
54
+ });
55
+ });
@@ -0,0 +1,19 @@
1
+ import { connectSignal } from '@flighthq/signals/contract';
2
+ import { describe, expect, it, vi } from 'vitest';
3
+
4
+ import { createStatechartInstance } from './statechart.ts';
5
+ import { emitStatechartStateChange } from './statechartSignalEmit.ts';
6
+ import { enableStatechartSignals } from './statechartSignals.ts';
7
+
8
+ describe('emitStatechartStateChange', () => {
9
+ it('emits the region, previous state and state as one tuple payload', () => {
10
+ const instance = createStatechartInstance({ inputs: [], regions: [] });
11
+ const signals = enableStatechartSignals(instance);
12
+ const listener = vi.fn();
13
+ connectSignal(signals.onStateChange, listener);
14
+
15
+ emitStatechartStateChange(signals, 2, 3, 4);
16
+
17
+ expect(listener).toHaveBeenCalledWith([2, 3, 4]);
18
+ });
19
+ });
@@ -1,14 +1,14 @@
1
1
  import { connectSignal } from '@flighthq/signals/contract';
2
- import { StatechartAtomicStateKind } from '@flighthq/types/contract';
3
- import type { Statechart } from '@flighthq/types/contract';
4
2
 
5
3
  import {
6
4
  advanceStatechartInstance,
7
5
  createStatechartInstance,
8
6
  fireStatechartTrigger,
9
7
  setStatechartRegionDuration,
10
- } from './statechart';
11
- import { enableStatechartSignals, getStatechartSignals, initializeStatechartSignals } from './statechartSignals';
8
+ } from './statechart.ts';
9
+ import { enableStatechartSignals, getStatechartSignals, initializeStatechartSignals } from './statechartSignals.ts';
10
+ import { StatechartAtomicStateKind } from './types.ts';
11
+ import type { StatechartRaw } from './types.ts';
12
12
 
13
13
  describe('enableStatechartSignals', () => {
14
14
  it('lazily attaches one standard signal group to the mutable instance', () => {
@@ -17,14 +17,14 @@ describe('enableStatechartSignals', () => {
17
17
  const second = enableStatechartSignals(instance);
18
18
  expect(first).toBe(second);
19
19
  expect(instance.signals).toBe(first);
20
- expect(first.onStateChange.data).toBeNull();
20
+ expect(first.onStateChange.data).toBeUndefined();
21
21
  });
22
22
 
23
23
  it('observes completed entry and exit without putting a closure on authored state data', () => {
24
24
  const chart = createImmediateChart();
25
25
  const instance = createStatechartInstance(chart);
26
26
  const calls: number[][] = [];
27
- connectSignal(enableStatechartSignals(instance).onStateChange, (regionIndex, previousState, state) => {
27
+ connectSignal(enableStatechartSignals(instance).onStateChange, ([regionIndex, previousState, state]) => {
28
28
  calls.push([regionIndex, previousState, state]);
29
29
  });
30
30
 
@@ -34,7 +34,7 @@ describe('enableStatechartSignals', () => {
34
34
  });
35
35
 
36
36
  it('emits after trigger cleanup so a listener can latch an edge for the next pass', () => {
37
- const chart: Statechart = {
37
+ const chart: StatechartRaw = {
38
38
  inputs: [{ initialValue: 0, kind: 'Trigger' }],
39
39
  regions: [
40
40
  {
@@ -60,7 +60,7 @@ describe('enableStatechartSignals', () => {
60
60
  it('lets composition supply the entered state duration after core resets the old one', () => {
61
61
  const instance = createStatechartInstance(createImmediateChart());
62
62
  setStatechartRegionDuration(instance, 0, 100);
63
- connectSignal(enableStatechartSignals(instance).onStateChange, (regionIndex) => {
63
+ connectSignal(enableStatechartSignals(instance).onStateChange, ([regionIndex]) => {
64
64
  setStatechartRegionDuration(instance, regionIndex, 250);
65
65
  });
66
66
  advanceStatechartInstance(instance, 0);
@@ -77,7 +77,7 @@ describe('getStatechartSignals', () => {
77
77
  });
78
78
  });
79
79
 
80
- function createImmediateChart(): Statechart {
80
+ function createImmediateChart(): StatechartRaw {
81
81
  return {
82
82
  inputs: [],
83
83
  regions: [
@@ -0,0 +1,25 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import {
4
+ createStatechartFloat32Array,
5
+ createStatechartFloat64Array,
6
+ createStatechartInt32Array,
7
+ } from './statechartTypedArrays.ts';
8
+
9
+ describe('createStatechartFloat32Array', () => {
10
+ it('allocates a zeroed Float32Array', () => {
11
+ expect(createStatechartFloat32Array(2)).toEqual(new Float32Array([0, 0]));
12
+ });
13
+ });
14
+
15
+ describe('createStatechartFloat64Array', () => {
16
+ it('allocates a zeroed Float64Array', () => {
17
+ expect(createStatechartFloat64Array(2)).toEqual(new Float64Array([0, 0]));
18
+ });
19
+ });
20
+
21
+ describe('createStatechartInt32Array', () => {
22
+ it('allocates and fills an Int32Array', () => {
23
+ expect(createStatechartInt32Array(2, -1)).toEqual(new Int32Array([-1, -1]));
24
+ });
25
+ });