Skip to content

Commit

Permalink
WB-784: test(state): remove tests for invalid final state definitions
Browse files Browse the repository at this point in the history
These tests were removed as the associated validation for final state definitions is no longer necessary or applicable.
  • Loading branch information
deligoez committed Dec 12, 2024
1 parent abe9843 commit 8a3a310
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions tests/StateDefinitionTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Tarfinlabs\EventMachine\Enums\StateDefinitionType;
use Tarfinlabs\EventMachine\Definition\MachineDefinition;
use Tarfinlabs\EventMachine\Tests\Stubs\Results\GreenResult;
use Tarfinlabs\EventMachine\Exceptions\InvalidFinalStateDefinitionException;

test('a state definition can be atomic', function (): void {
$machine = MachineDefinition::define(config: [
Expand Down Expand Up @@ -96,44 +95,6 @@
'@green',
]);

test('a final state definition can not have child states', function (): void {
MachineDefinition::define(config: [
'initial' => 'yellow',
'states' => [
'yellow' => [
'type' => 'final',
'states' => [
'a' => [],
'b' => [],
],
],
],
]);
})->throws(
exception: InvalidFinalStateDefinitionException::class,
exceptionMessage: 'The final state `machine.yellow` should not have child states. Please revise your state machine definitions to ensure that final states are correctly configured without child states.'
);

test('a final state definition can not have transitions', function (): void {
MachineDefinition::define(config: [
'initial' => 'yellow',
'states' => [
'yellow' => [
'type' => 'final',
'on' => [
'EVENT' => [
'target' => 'red',
],
],
],
'red' => [],
],
]);
})->throws(
exception: InvalidFinalStateDefinitionException::class,
exceptionMessage: 'The final state `machine.yellow` should not have transitions. Check your state machine configuration to ensure events are not dispatched when in a final state.'
);

test('an initial state of type final triggers machine finish event', function (): void {
$machine = Machine::create(definition: [
'config' => [
Expand Down

0 comments on commit 8a3a310

Please sign in to comment.