Test Cases
🕙 Start time | ⌛ Duration |
---|---|
12/28/2024, 3:05:54 PM | 2.879 s |
✅ Passed | ❌ Failed | ⏩ Skipped | 🚧 Todo | ⚪ Total | |
---|---|---|---|---|---|
Test Suites | 26 | 0 | 0 | 0 | 26 |
Tests | 87 | 0 | 1 | 0 | 88 |
✅ src/codegenAutomata.test.ts
13 passed, 0 failed, 0 skipped, 0 todo, done in 6.712568999999917 s
✅ codegen output › gamePhaseAutomata
✅ initial state
✅ the context and state do not change with the wrong action.
✅ automata must have id
✅ automata must have actions
✅ automata must have states
✅ automata.getState must return numeric state
✅ [{"action":77866287,"payload":{}}] -- > 2252048
✅ [{"action":77866287,"payload":{}},{"action":81515,"payload":{}}] -- > 69824076
✅ [{"action":77866287,"payload":{}},{"action":81515,"payload":{}},{"action":407301981,"payload":{}}] -- > 1730055131
✅ [{"action":77866287,"payload":{}},{"action":81515,"payload":{}},{"action":407301981,"payload":{}},{"action":1973300761,"payload":{}}] -- > 1929949911
✅ [{"action":77866287,"payload":{}},{"action":81515,"payload":{}},{"action":407301981,"payload":{}},{"action":1973300761,"payload":{}},{"action":1058895409,"payload":{}},{"action":1626434024,"payload":{}}] -- > 1608719668
✅ [{"action":77866287,"payload":{}},{"action":81515,"payload":{}},{"action":407301981,"payload":{}},{"action":1973300761,"payload":{}},{"action":1058895409,"payload":{}},{"action":1626434024,"payload":{}},{"action":1757631242,"payload":{}}] -- > 1985829159
✅ [{"action":77866287,"payload":{}},{"action":81515,"payload":{}},{"action":407301981,"payload":{}},{"action":1973300761,"payload":{}},{"action":1058895409,"payload":{}},{"action":1626434024,"payload":{}},{"action":1757631242,"payload":{}}] -- > 1985829159
✅ codegen output
✅ src/codegenNotes.test.ts
37 passed, 0 failed, 1 skipped, 0 todo, done in 554.228276 s
✅ byPass state
✅ should throw an error if the ByPass state has more than 1 transition
✅ should throw an error if the ByPass state has no transition
✅ should throw an error if the ByPass state has no action [-]
✅ payload is not propagated through ByPass
✅ the finite automaton must go to the next state after the byPasses state
✅ default assign
✅ left assign #{a=string | constant | number | list | emptyPayload = {} | emptypreviousContext = {} }
✅ left assign with previous context and payload #{ a=$payload, $b=#prevContext } prevContext - all expressions
✅ right assign with #a,#b = (list, constant, integer, string, payload = {}, prevContext = {})
✅ right assign payload $a,$b = (list, constant, integer, string, payload = {}, prevContext = {}
✅ in the function call #{a} <= add($a=10, $b=5)
✅ reducers
✅ #{a,b} from previous to shortcut, prev:{a:3,b:"str"}
✅ #{a,b} shortcut, with missing previus context, "a" and "b" should be null
✅ #{a,b} <= #a, #b, with previous context
✅ #{a,b} <= #a, #b, previous context is missing
✅ #{a,b,c,d} <= payload(integer), payload(string)...
✅ #{} <= $payload, without passed payload
✅ #{a} <= expressions(string,number,arr)
✅ #{a} <= add($a,$b)
✅ constants reference
✅ constant reference should be replaced by value in dictionary
✅ constant value should be number or string
✅ codegen should throw an error if there is no key found in the dictionary.
✅ codgen should throw an error if the dictionary is missing
✅ initial
✅ the +INIT state must be the initial state for the automata
✅ by default start state should be first state in note
✅ default context
✅ reducer from [*] shared between states
✅ by default, the context should be empty object
✅ functions
✅ nested call, mult(avg($list),$count)
✅ function calls with mixed argument types (payload, constant, literal)
✅ chained function calls
✅ function calls with array operations
✅ user defined functions
⏩ simple function returning a constant value, define/f () => 3
✅ codegen should catch cyclic dependencies and throw an error
define/lol1 () => kek1()
define/kek1 () => kek2()
define/kek2 () => kek3()
define/kek3 () => kek4()
define/kek4 () => kek5()
define/kek5 () => kek6()
define/kek6 () => lol1()
✅ the order in which the function is defined has no effect
define/kek2 () => add(1,2)
define/lol2 () => kek2()
✅ without arguments in a defined function, define/lol3 () => add(1,2)
✅ with arguments in a defined function, define/lol4 (a,b) => add(a,b)
✅ with arguments and value, define/lol5 (a) => add(a,3)
✅ complex function with constants, define/complexFunc (x, y) => add(mult(%%BASE, x), mult(%%MULTIPLIER, y), %%OFFSET)
✅ function with passed previous context and payload
✅ src/events.test.ts
11 passed, 0 failed, 0 skipped, 0 todo, done in 172.02078600000004 s
✅ automata Events › event Adapter
✅ automata has an Event Adapter
✅ event Adapter is pre-loaded with events from diagram
✅ can add new Event Emitters to Adapter
✅ can add new Event Listeners to Adapter
✅ can set new Event Adapter
✅ automata Events › event interactions
✅ automata can listen to events dispatched by event bus
✅ subscribe/emit in 1 automata
✅ state of automata#1 changes after emit from automata#2
✅ state of automata#1 does not change on emitting wrong events from automata#2
✅ action payload can be filled from incoming event meta information
✅ event meta information can be filled from context of the automata
✅ automata Events
✅ src/forks.test.ts
16 passed, 0 failed, 0 skipped, 0 todo, done in 14.890251999999919 s
✅ forks › default
✅ init
✅ automata is in working state
✅ transition into END state if condition is TRUE
✅ transition back into WORKING state if condition is FALSE
✅ state reducer is invoked when transitioning to the same state after the fork
✅ forks › fork with no default path
✅ init
✅ automata is in working state
✅ transition into State1 state if isGreater is TRUE
✅ transition into State2 state if isZero is TRUE
✅ staying in WORKING state if no condition is TRUE
✅ state reducer is NOT invoked when staying on the same state
✅ forks › fork that leads into another fork
✅ init
✅ automata is in working state
✅ transition into State1 state if isGreater is TRUE
✅ transition into State2 state if isGreater is FALSE, and isPositive is TRUE
✅ transition back into WORKING state as a default path for the second fork, if isGreater and isPositive are FALSE
✅ forks › fork with duplicate default paths is not generated
✅ forks
✅ src/functionDictionary_js-ts.test.ts
10 passed, 0 failed, 0 skipped, 0 todo, done in 25.948812999999973 s
✅ jS/TS Function Dictionary › can get functions from a dictionary
✅ built-in functions
✅ custom functions
✅ jS/TS Function Dictionary › cannot register a function under an already existing key
✅ built-in keys
✅ custom key
✅ jS/TS Function Dictionary
✅ dictionary is not empty and has built-in functions inside upon creation
✅ cannot get a function under a non-existing key
✅ can register custom functions inside of a dictionary
✅ custom functions return the same result before and after being added to a dictionary
✅ cannot register a function with incorrect key length
✅ cannot register a function with incorrect key format