Skip to content

Test Cases

🕙 Start time⌛ Duration
10/18/2024, 1:52:43 PM2.595 s
✅ Passed❌ Failed⏩ Skipped🚧 Todo⚪ Total
Test Suites2100021
Tests7101072

src/codegenAutomata.test.ts

13 passed, 0 failed, 0 skipped, 0 todo, done in 7.629438999999934 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

32 passed, 0 failed, 1 skipped, 0 todo, done in 456.50573499999996 s

✅ 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/forks.test.ts

16 passed, 0 failed, 0 skipped, 0 todo, done in 13.11307099999999 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 30.531914000000143 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