@nyaruka/temba-components 0.129.8 → 0.129.9

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 (203) hide show
  1. package/CHANGELOG.md +27 -3
  2. package/demo/data/flows/sample-flow.json +186 -96
  3. package/dist/temba-components.js +414 -351
  4. package/dist/temba-components.js.map +1 -1
  5. package/out-tsc/src/events.js.map +1 -1
  6. package/out-tsc/src/excellent/helpers.js +2 -2
  7. package/out-tsc/src/excellent/helpers.js.map +1 -1
  8. package/out-tsc/src/flow/CanvasNode.js +25 -7
  9. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  10. package/out-tsc/src/flow/Editor.js +11 -1
  11. package/out-tsc/src/flow/Editor.js.map +1 -1
  12. package/out-tsc/src/flow/NodeEditor.js +133 -290
  13. package/out-tsc/src/flow/NodeEditor.js.map +1 -1
  14. package/out-tsc/src/flow/actions/add_input_labels.js +40 -0
  15. package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -1
  16. package/out-tsc/src/flow/actions/call_llm.js +56 -3
  17. package/out-tsc/src/flow/actions/call_llm.js.map +1 -1
  18. package/out-tsc/src/flow/actions/call_webhook.js +1 -1
  19. package/out-tsc/src/flow/actions/call_webhook.js.map +1 -1
  20. package/out-tsc/src/flow/actions/open_ticket.js +65 -3
  21. package/out-tsc/src/flow/actions/open_ticket.js.map +1 -1
  22. package/out-tsc/src/flow/actions/set_run_result.js +75 -0
  23. package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
  24. package/out-tsc/src/flow/config.js +4 -0
  25. package/out-tsc/src/flow/config.js.map +1 -1
  26. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +227 -0
  27. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -0
  28. package/out-tsc/src/flow/nodes/split_by_ticket.js +18 -0
  29. package/out-tsc/src/flow/nodes/split_by_ticket.js.map +1 -0
  30. package/out-tsc/src/flow/nodes/wait_for_response.js +27 -1
  31. package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
  32. package/out-tsc/src/flow/types.js +0 -65
  33. package/out-tsc/src/flow/types.js.map +1 -1
  34. package/out-tsc/src/form/ArrayEditor.js +18 -61
  35. package/out-tsc/src/form/ArrayEditor.js.map +1 -1
  36. package/out-tsc/src/form/FieldRenderer.js +305 -0
  37. package/out-tsc/src/form/FieldRenderer.js.map +1 -0
  38. package/out-tsc/src/form/FormField.js +3 -3
  39. package/out-tsc/src/form/FormField.js.map +1 -1
  40. package/out-tsc/src/form/TextInput.js +1 -1
  41. package/out-tsc/src/form/TextInput.js.map +1 -1
  42. package/out-tsc/src/form/select/Select.js +48 -20
  43. package/out-tsc/src/form/select/Select.js.map +1 -1
  44. package/out-tsc/src/live/ContactChat.js +39 -13
  45. package/out-tsc/src/live/ContactChat.js.map +1 -1
  46. package/out-tsc/src/markdown.js +13 -11
  47. package/out-tsc/src/markdown.js.map +1 -1
  48. package/out-tsc/test/ActionHelper.js +2 -0
  49. package/out-tsc/test/ActionHelper.js.map +1 -1
  50. package/out-tsc/test/NodeHelper.js +148 -0
  51. package/out-tsc/test/NodeHelper.js.map +1 -0
  52. package/out-tsc/test/actions/call_llm.test.js +103 -0
  53. package/out-tsc/test/actions/call_llm.test.js.map +1 -0
  54. package/out-tsc/test/nodes/split_by_llm_categorize.test.js +532 -0
  55. package/out-tsc/test/nodes/split_by_llm_categorize.test.js.map +1 -0
  56. package/out-tsc/test/nodes/split_by_random.test.js +150 -0
  57. package/out-tsc/test/nodes/split_by_random.test.js.map +1 -0
  58. package/out-tsc/test/nodes/wait_for_digits.test.js +150 -0
  59. package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -0
  60. package/out-tsc/test/nodes/wait_for_response.test.js +171 -0
  61. package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -0
  62. package/out-tsc/test/temba-add-input-labels.test.js +70 -0
  63. package/out-tsc/test/temba-add-input-labels.test.js.map +1 -0
  64. package/out-tsc/test/temba-field-renderer.test.js +296 -0
  65. package/out-tsc/test/temba-field-renderer.test.js.map +1 -0
  66. package/out-tsc/test/temba-markdown.test.js +1 -1
  67. package/out-tsc/test/temba-markdown.test.js.map +1 -1
  68. package/out-tsc/test/temba-node-editor.test.js +400 -0
  69. package/out-tsc/test/temba-node-editor.test.js.map +1 -1
  70. package/out-tsc/test/temba-select.test.js +6 -3
  71. package/out-tsc/test/temba-select.test.js.map +1 -1
  72. package/out-tsc/test/temba-webchat.test.js +1 -1
  73. package/out-tsc/test/temba-webchat.test.js.map +1 -1
  74. package/package.json +1 -1
  75. package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
  76. package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
  77. package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
  78. package/screenshots/truth/actions/call_llm/editor/information-extraction.png +0 -0
  79. package/screenshots/truth/actions/call_llm/editor/sentiment-analysis.png +0 -0
  80. package/screenshots/truth/actions/call_llm/editor/summarization.png +0 -0
  81. package/screenshots/truth/actions/call_llm/editor/translation-task.png +0 -0
  82. package/screenshots/truth/actions/call_llm/render/information-extraction.png +0 -0
  83. package/screenshots/truth/actions/call_llm/render/sentiment-analysis.png +0 -0
  84. package/screenshots/truth/actions/call_llm/render/summarization.png +0 -0
  85. package/screenshots/truth/actions/call_llm/render/translation-task.png +0 -0
  86. package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
  87. package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
  88. package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
  89. package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
  90. package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
  91. package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
  92. package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
  93. package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
  94. package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
  95. package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
  96. package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
  97. package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
  98. package/screenshots/truth/editor/router.png +0 -0
  99. package/screenshots/truth/editor/send_msg.png +0 -0
  100. package/screenshots/truth/editor/set_contact_language.png +0 -0
  101. package/screenshots/truth/editor/set_contact_name.png +0 -0
  102. package/screenshots/truth/editor/set_run_result.png +0 -0
  103. package/screenshots/truth/editor/wait.png +0 -0
  104. package/screenshots/truth/field-renderer/checkbox-checked.png +0 -0
  105. package/screenshots/truth/field-renderer/checkbox-unchecked.png +0 -0
  106. package/screenshots/truth/field-renderer/checkbox-with-errors.png +0 -0
  107. package/screenshots/truth/field-renderer/context-comparison.png +0 -0
  108. package/screenshots/truth/field-renderer/key-value-with-label.png +0 -0
  109. package/screenshots/truth/field-renderer/message-editor-with-label.png +0 -0
  110. package/screenshots/truth/field-renderer/select-multi.png +0 -0
  111. package/screenshots/truth/field-renderer/select-no-label.png +0 -0
  112. package/screenshots/truth/field-renderer/select-with-label.png +0 -0
  113. package/screenshots/truth/field-renderer/text-evaluated.png +0 -0
  114. package/screenshots/truth/field-renderer/text-no-label.png +0 -0
  115. package/screenshots/truth/field-renderer/text-with-errors.png +0 -0
  116. package/screenshots/truth/field-renderer/text-with-label.png +0 -0
  117. package/screenshots/truth/field-renderer/textarea-evaluated.png +0 -0
  118. package/screenshots/truth/field-renderer/textarea-with-label.png +0 -0
  119. package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
  120. package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
  121. package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
  122. package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
  123. package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
  124. package/screenshots/truth/nodes/split_by_llm_categorize/render/basic-categorization.png +0 -0
  125. package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
  126. package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
  127. package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
  128. package/screenshots/truth/nodes/split_by_llm_categorize/render/minimal-categories.png +0 -0
  129. package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
  130. package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
  131. package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
  132. package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
  133. package/screenshots/truth/nodes/split_by_random/render/ab-test-multiple-variants.png +0 -0
  134. package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
  135. package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
  136. package/screenshots/truth/nodes/split_by_random/render/two-bucket-split.png +0 -0
  137. package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
  138. package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
  139. package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
  140. package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
  141. package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
  142. package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
  143. package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
  144. package/screenshots/truth/nodes/wait_for_digits/render/verification-code.png +0 -0
  145. package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
  146. package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
  147. package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
  148. package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
  149. package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
  150. package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
  151. package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
  152. package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
  153. package/screenshots/truth/omnibox/selected.png +0 -0
  154. package/screenshots/truth/select/functions.png +0 -0
  155. package/screenshots/truth/select/multi-with-endpoint.png +0 -0
  156. package/screenshots/truth/select/search-enabled.png +0 -0
  157. package/src/events.ts +8 -1
  158. package/src/excellent/helpers.ts +2 -2
  159. package/src/flow/CanvasNode.ts +22 -1
  160. package/src/flow/Editor.ts +12 -1
  161. package/src/flow/NodeEditor.ts +186 -374
  162. package/src/flow/actions/add_input_labels.ts +45 -0
  163. package/src/flow/actions/call_llm.ts +57 -3
  164. package/src/flow/actions/call_webhook.ts +1 -1
  165. package/src/flow/actions/open_ticket.ts +74 -3
  166. package/src/flow/actions/set_run_result.ts +83 -0
  167. package/src/flow/config.ts +4 -0
  168. package/src/flow/nodes/split_by_llm_categorize.ts +277 -0
  169. package/src/flow/nodes/split_by_ticket.ts +19 -0
  170. package/src/flow/nodes/wait_for_response.ts +28 -1
  171. package/src/flow/types.ts +26 -127
  172. package/src/form/ArrayEditor.ts +34 -82
  173. package/src/form/FieldRenderer.ts +465 -0
  174. package/src/form/FormField.ts +3 -3
  175. package/src/form/TextInput.ts +1 -1
  176. package/src/form/select/Select.ts +51 -20
  177. package/src/live/ContactChat.ts +39 -15
  178. package/src/markdown.ts +19 -11
  179. package/src/store/flow-definition.d.ts +5 -2
  180. package/static/api/labels.json +31 -0
  181. package/static/api/topics.json +24 -9
  182. package/static/api/users.json +35 -16
  183. package/static/css/temba-components.css +3 -3
  184. package/stress-test.js +18 -13
  185. package/test/ActionHelper.ts +2 -0
  186. package/test/NodeHelper.ts +184 -0
  187. package/test/actions/call_llm.test.ts +137 -0
  188. package/test/nodes/README.md +78 -0
  189. package/test/nodes/split_by_llm_categorize.test.ts +698 -0
  190. package/test/nodes/split_by_random.test.ts +177 -0
  191. package/test/nodes/wait_for_digits.test.ts +176 -0
  192. package/test/nodes/wait_for_response.test.ts +206 -0
  193. package/test/temba-add-input-labels.test.ts +87 -0
  194. package/test/temba-field-renderer.test.ts +482 -0
  195. package/test/temba-markdown.test.ts +1 -1
  196. package/test/temba-node-editor.test.ts +496 -0
  197. package/test/temba-select.test.ts +6 -6
  198. package/test/temba-webchat.test.ts +1 -1
  199. package/test-assets/select/llms.json +18 -0
  200. package/web-dev-mock.mjs +96 -6
  201. package/web-dev-server.config.mjs +29 -7
  202. package/test/temba-flow-editor.test.ts.backup +0 -563
  203. package/test/temba-utils-index.test.ts.backup +0 -1737
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split_by_llm_categorize.test.js","sourceRoot":"","sources":["../../../test/nodes/split_by_llm_categorize.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAEvF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,gEAAgE;AAChE,SAAS,iBAAiB,CAAC,aAAuB;IAChD,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,MAAM,KAAK,GAAG,EAAE,CAAC;IAEjB,sBAAsB;IACtB,aAAa,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE;QACrC,MAAM,YAAY,GAAG,YAAY,YAAY;aAC1C,WAAW,EAAE;aACb,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,QAAQ,YAAY,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EA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ACrC,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CACpC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,SAAS,CAC3C,CAAC;gBACF,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;YAChC,CAAC,CAAC,CAAC;YAEH,qCAAqC;YACrC,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAC1C,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,OAAO,CAC9B,CAAC;YACF,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,aAAc,CAAC,IAAI,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { split_by_llm_categorize } from '../../src/flow/nodes/split_by_llm_categorize';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n// Helper function to create routers with proper cases and exits\nfunction createSplitRouter(categoryNames: string[]) {\n const categories = [];\n const exits = [];\n const cases = [];\n\n // Add user categories\n categoryNames.forEach((categoryName) => {\n const categoryUuid = `category-${categoryName\n .toLowerCase()\n .replace(/\\s+/g, '-')}`;\n const exitUuid = `exit-${categoryName.toLowerCase().replace(/\\s+/g, '-')}`;\n const caseUuid = `case-${categoryName.toLowerCase().replace(/\\s+/g, '-')}`;\n\n categories.push({\n uuid: categoryUuid,\n name: categoryName,\n exit_uuid: exitUuid\n });\n\n exits.push({\n uuid: exitUuid,\n destination_uuid: null\n });\n\n cases.push({\n uuid: caseUuid,\n type: 'has_only_text',\n arguments: [categoryName],\n category_uuid: categoryUuid\n });\n });\n\n // Add \"Other\" category (default)\n const otherCategoryUuid = 'category-other';\n const otherExitUuid = 'exit-other';\n\n categories.push({\n uuid: otherCategoryUuid,\n name: 'Other',\n exit_uuid: otherExitUuid\n });\n exits.push({\n uuid: otherExitUuid,\n destination_uuid: null\n });\n\n // Add \"Failure\" category\n const failureCategoryUuid = 'category-failure';\n const failureExitUuid = 'exit-failure';\n const failureCaseUuid = 'case-failure';\n\n categories.push({\n uuid: failureCategoryUuid,\n name: 'Failure',\n exit_uuid: failureExitUuid\n });\n exits.push({\n uuid: failureExitUuid,\n destination_uuid: null\n });\n\n // Add failure case for <ERROR>\n cases.push({\n uuid: failureCaseUuid,\n type: 'has_only_text',\n arguments: ['<ERROR>'],\n category_uuid: failureCategoryUuid\n });\n\n return {\n router: {\n type: 'switch' as const,\n categories: categories,\n default_category_uuid: otherCategoryUuid,\n operand: '@locals._llm_output',\n cases: cases\n },\n exits: exits\n };\n}\n\n/**\n * Test suite for the split_by_llm_categorize node configuration.\n */\ndescribe('split_by_llm_categorize node config', () => {\n const helper = new NodeTest(\n split_by_llm_categorize,\n 'split_by_llm_categorize'\n );\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(split_by_llm_categorize.name).to.equal('Split by AI');\n });\n\n it('has correct type', () => {\n expect(split_by_llm_categorize.type).to.equal('split_by_llm_categorize');\n });\n });\n\n describe('node scenarios', () => {\n const basicRouter = createSplitRouter(['Greeting', 'Question']);\n helper.testNode(\n {\n uuid: 'test-node-1',\n actions: [\n {\n uuid: 'call-llm-uuid',\n type: 'call_llm',\n llm: { uuid: 'llm-123', name: 'Claude' },\n input: '@input',\n instructions:\n '@(prompt(\"categorize\", slice(node.categories, 0, -2)))',\n output_local: '_llm_output'\n } as any\n ],\n router: basicRouter.router,\n exits: basicRouter.exits\n } as Node,\n { type: 'split_by_llm_categorize' },\n 'basic-categorization'\n );\n\n const premiumRouter = createSplitRouter(['Premium', 'Regular', 'VIP']);\n helper.testNode(\n {\n uuid: 'test-node-2',\n actions: [\n {\n uuid: 'call-llm-uuid-2',\n type: 'call_llm',\n llm: { uuid: 'llm-456', name: 'GPT-4' },\n input: '@contact.name',\n instructions:\n '@(prompt(\"categorize\", slice(node.categories, 0, -2)))',\n output_local: '_llm_output'\n } as any\n ],\n router: premiumRouter.router,\n exits: premiumRouter.exits\n } as Node,\n { type: 'split_by_llm_categorize' },\n 'custom-input-and-result-name'\n );\n\n const priorityRouter = createSplitRouter([\n 'High',\n 'Medium',\n 'Low',\n 'Critical',\n 'Urgent'\n ]);\n helper.testNode(\n {\n uuid: 'test-node-3',\n actions: [\n {\n uuid: 'call-llm-uuid-3',\n type: 'call_llm',\n llm: { uuid: 'llm-789', name: 'Gemini' },\n input: '@fields.priority',\n instructions:\n '@(prompt(\"categorize\", slice(node.categories, 0, -2)))',\n output_local: '_llm_output'\n } as any\n ],\n router: priorityRouter.router,\n exits: priorityRouter.exits\n } as Node,\n { type: 'split_by_llm_categorize' },\n 'many-categories'\n );\n\n const minimalRouter = createSplitRouter(['Yes']);\n helper.testNode(\n {\n uuid: 'test-node-4',\n actions: [\n {\n uuid: 'call-llm-uuid-4',\n type: 'call_llm',\n llm: { uuid: 'llm-minimal', name: 'Basic LLM' },\n input: '@input',\n instructions:\n '@(prompt(\"categorize\", slice(node.categories, 0, -2)))',\n output_local: '_llm_output'\n } as any\n ],\n router: minimalRouter.router,\n exits: minimalRouter.exits\n } as Node,\n { type: 'split_by_llm_categorize' },\n 'minimal-categories'\n );\n\n const feedbackRouter = createSplitRouter([\n 'Bug Report',\n 'Feature Request',\n 'General Feedback',\n 'Support Request'\n ]);\n helper.testNode(\n {\n uuid: 'test-node-5',\n actions: [\n {\n uuid: 'call-llm-uuid-5',\n type: 'call_llm',\n llm: { uuid: 'llm-special', name: 'Special Characters LLM' },\n input: '@contact.fields.feedback',\n instructions:\n '@(prompt(\"categorize\", slice(node.categories, 0, -2)))',\n output_local: '_llm_output'\n } as any\n ],\n router: feedbackRouter.router,\n exits: feedbackRouter.exits\n } as Node,\n { type: 'split_by_llm_categorize' },\n 'feedback-categorization'\n );\n });\n\n describe('round-trip conversion validation', () => {\n it('converts to form data correctly', () => {\n const testRouter = createSplitRouter(['Greeting', 'Question']);\n const node: Node = {\n uuid: 'test-node',\n actions: [\n {\n uuid: 'call-llm-uuid',\n type: 'call_llm',\n llm: { uuid: 'llm-123', name: 'Test LLM' },\n input: '@input',\n instructions:\n '@(prompt(\"categorize\", slice(node.categories, 0, -2)))',\n output_local: '_llm_output'\n } as any\n ],\n router: testRouter.router,\n exits: testRouter.exits\n };\n\n const formData = split_by_llm_categorize.toFormData!(node);\n\n expect(formData.uuid).to.equal('test-node');\n expect(formData.llm).to.deep.equal([\n { value: 'llm-123', name: 'Test LLM' }\n ]);\n expect(formData.input).to.equal('@input');\n expect(formData.categories).to.deep.equal([\n { name: 'Greeting' },\n { name: 'Question' }\n ]);\n });\n\n it('converts from form data correctly', () => {\n const formData = {\n uuid: 'test-node',\n llm: [{ value: 'llm-456', name: 'GPT-4' }],\n input: '@contact.name',\n categories: [{ name: 'Premium' }, { name: 'Regular' }]\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: []\n };\n\n const result = split_by_llm_categorize.fromFormData!(\n formData,\n originalNode\n );\n\n expect(result.uuid).to.equal('test-node');\n expect(result.actions).to.have.length(1);\n expect(result.actions[0].type).to.equal('call_llm');\n expect((result.actions[0] as any).llm.uuid).to.equal('llm-456');\n expect((result.actions[0] as any).llm.name).to.equal('GPT-4');\n expect((result.actions[0] as any).input).to.equal('@contact.name');\n\n // Should have user categories plus Other and Failure\n expect(result.router!.categories).to.have.length(4);\n const categoryNames = result.router!.categories.map((cat) => cat.name);\n expect(categoryNames).to.include.members([\n 'Premium',\n 'Regular',\n 'Other',\n 'Failure'\n ]);\n\n // Should have corresponding exits\n expect(result.exits).to.have.length(4);\n });\n });\n\n describe('edge cases and validation', () => {\n it('handles categories with empty names correctly', () => {\n const formData = {\n uuid: 'test-node-uuid',\n llm: [{ value: 'llm-uuid-123', name: 'Claude' }],\n input: '@input',\n categories: [\n { name: 'Valid Category' },\n { name: '' }, // empty name\n { name: ' ' }, // only whitespace\n { name: 'Another Valid' }\n ],\n result_name: 'Intent'\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n exits: []\n };\n\n const result = split_by_llm_categorize.fromFormData!(\n formData,\n originalNode\n );\n\n // Should only include non-empty categories\n const userCategories = result.router!.categories.filter(\n (cat) => cat.name !== 'Other' && cat.name !== 'Failure'\n );\n expect(userCategories).to.have.length(2);\n expect(userCategories.map((cat) => cat.name)).to.deep.equal([\n 'Valid Category',\n 'Another Valid'\n ]);\n });\n\n it('handles categories with special characters', () => {\n const formData = {\n uuid: 'test-node-uuid',\n llm: [{ value: 'llm-uuid-123', name: 'Claude' }],\n input: '@input',\n categories: [\n { name: 'Category-1' },\n { name: 'Category_2' },\n { name: 'Category@3' },\n { name: 'Category with spaces' }\n ],\n result_name: 'Intent'\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n exits: []\n };\n\n const result = split_by_llm_categorize.fromFormData!(\n formData,\n originalNode\n );\n\n // Should preserve all special characters in category names\n const userCategories = result.router!.categories.filter(\n (cat) => cat.name !== 'Other' && cat.name !== 'Failure'\n );\n expect(userCategories).to.have.length(4);\n expect(userCategories.map((cat) => cat.name)).to.include.members([\n 'Category-1',\n 'Category_2',\n 'Category@3',\n 'Category with spaces'\n ]);\n\n // Verify cases also have correct names\n const caseNames = result\n .router!.cases.filter((c) => c.arguments[0] !== '<ERROR>')\n .map((c) => c.arguments[0]);\n expect(caseNames).to.include.members([\n 'Category-1',\n 'Category_2',\n 'Category@3',\n 'Category with spaces'\n ]);\n });\n\n it('maintains UUID consistency between categories, cases, and exits', () => {\n const formData = {\n uuid: 'test-node-uuid',\n llm: [{ value: 'llm-uuid-123', name: 'Claude' }],\n input: '@input',\n categories: [{ name: 'Test Category' }],\n result_name: 'Intent'\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n exits: []\n };\n\n const result = split_by_llm_categorize.fromFormData!(\n formData,\n originalNode\n );\n\n // Find the test category\n const testCategory = result.router!.categories.find(\n (cat) => cat.name === 'Test Category'\n );\n const testCase = result.router!.cases.find(\n (c) => c.arguments[0] === 'Test Category'\n );\n const testExit = result.exits.find(\n (exit) => exit.uuid === testCategory!.exit_uuid\n );\n\n // Verify UUID consistency\n expect(testCase!.category_uuid).to.equal(testCategory!.uuid);\n expect(testExit!.uuid).to.equal(testCategory!.exit_uuid);\n });\n\n it('generates unique UUIDs for each run', () => {\n const formData = {\n uuid: 'test-node-uuid',\n llm: [{ value: 'llm-uuid-123', name: 'Claude' }],\n input: '@input',\n categories: [{ name: 'Test' }],\n result_name: 'Intent'\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n exits: []\n };\n\n const result1 = split_by_llm_categorize.fromFormData!(\n formData,\n originalNode\n );\n const result2 = split_by_llm_categorize.fromFormData!(\n formData,\n originalNode\n );\n\n // UUIDs should be different for each generation\n expect(result1.actions[0].uuid).to.not.equal(result2.actions[0].uuid);\n expect(result1.router!.categories[0].uuid).to.not.equal(\n result2.router!.categories[0].uuid\n );\n expect(result1.exits[0].uuid).to.not.equal(result2.exits[0].uuid);\n });\n\n it('roundtrip conversion (fromFormData -> toFormData) works correctly', () => {\n const originalFormData = {\n uuid: 'test-node-uuid',\n llm: [{ value: 'llm-uuid-123', name: 'Claude' }],\n input: '@custom.input',\n categories: [{ name: 'Category1' }, { name: 'Category2' }],\n result_name: 'CustomResult'\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n exits: []\n };\n\n // Convert form data to node\n const node = split_by_llm_categorize.fromFormData!(\n originalFormData,\n originalNode\n );\n\n // Convert back to form data\n const recoveredFormData = split_by_llm_categorize.toFormData!(node);\n\n // Should match original data\n expect(recoveredFormData.uuid).to.equal(originalFormData.uuid);\n expect(recoveredFormData.llm).to.deep.equal(originalFormData.llm);\n expect(recoveredFormData.input).to.equal(originalFormData.input);\n expect(recoveredFormData.categories).to.deep.equal(\n originalFormData.categories\n );\n });\n\n it('handles max 10 categories requirement', () => {\n // Create 12 categories to test the limit\n const categories = Array.from({ length: 12 }, (_, i) => ({\n name: `Category${i + 1}`\n }));\n\n const formData = {\n uuid: 'test-node-uuid',\n llm: [{ value: 'llm-uuid-123', name: 'Claude' }],\n input: '@input',\n categories: categories,\n result_name: 'Intent'\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n exits: []\n };\n\n const result = split_by_llm_categorize.fromFormData!(\n formData,\n originalNode\n );\n\n // Should process all categories provided (fromFormData doesn't enforce the limit, validation should)\n const userCategories = result.router!.categories.filter(\n (cat) => cat.name !== 'Other' && cat.name !== 'Failure'\n );\n expect(userCategories).to.have.length(12);\n\n // Note: The actual 10-category limit should be enforced by the UI validation\n // which uses the maxItems: 10 property in the form configuration\n });\n\n it('preserves original node UUID', () => {\n const formData = {\n uuid: 'should-be-ignored',\n llm: [{ value: 'llm-uuid-123', name: 'Claude' }],\n input: '@input',\n categories: [{ name: 'Test' }],\n result_name: 'Intent'\n };\n\n const originalNode: Node = {\n uuid: 'original-node-uuid',\n actions: [],\n exits: []\n };\n\n const result = split_by_llm_categorize.fromFormData!(\n formData,\n originalNode\n );\n\n // Should use original node UUID, not the one from form data\n expect(result.uuid).to.equal('original-node-uuid');\n });\n });\n\n describe('validation', () => {\n it('should validate duplicate category names', () => {\n const formData = {\n uuid: 'test-node-uuid',\n llm: [{ value: 'llm-uuid-123', name: 'Claude' }],\n input: '@input',\n categories: [\n { name: 'Category1' },\n { name: 'Category2' },\n { name: 'Category1' }, // duplicate\n { name: 'category2' }, // case insensitive duplicate\n { name: 'Category3' }\n ]\n };\n\n const validationResult = split_by_llm_categorize.validate!(formData);\n\n expect(validationResult.valid).to.be.false;\n expect(validationResult.errors.categories).to.include(\n 'Duplicate category names found'\n );\n expect(validationResult.errors.categories).to.include('Category1');\n expect(validationResult.errors.categories).to.include('Category2');\n expect(validationResult.errors.categories).to.include('category2');\n });\n\n it('should pass validation with unique category names', () => {\n const formData = {\n uuid: 'test-node-uuid',\n llm: [{ value: 'llm-uuid-123', name: 'Claude' }],\n input: '@input',\n categories: [\n { name: 'Category1' },\n { name: 'Category2' },\n { name: 'Category3' }\n ]\n };\n\n const validationResult = split_by_llm_categorize.validate!(formData);\n\n expect(validationResult.valid).to.be.true;\n expect(Object.keys(validationResult.errors)).to.have.length(0);\n });\n\n it('should ignore empty categories in validation', () => {\n const formData = {\n uuid: 'test-node-uuid',\n llm: [{ value: 'llm-uuid-123', name: 'Claude' }],\n input: '@input',\n categories: [\n { name: 'Category1' },\n { name: '' }, // empty\n { name: ' ' }, // whitespace only\n { name: 'Category2' }\n ]\n };\n\n const validationResult = split_by_llm_categorize.validate!(formData);\n\n expect(validationResult.valid).to.be.true;\n expect(Object.keys(validationResult.errors)).to.have.length(0);\n });\n });\n\n describe('JSON output verification', () => {\n it('generates JSON matching the exact format from the issue', () => {\n const formData = {\n uuid: '145eb3d3-b841-4e66-abac-297ae525c7ad',\n llm: [\n { value: '1c06c884-39dd-4ce4-ad9f-9a01cbe6c000', name: 'Claude' }\n ],\n input: '@input',\n categories: [{ name: 'Flights' }, { name: 'Hotels' }],\n result_name: 'Intent'\n };\n\n const originalNode: Node = {\n uuid: '145eb3d3-b841-4e66-abac-297ae525c7ad',\n actions: [],\n exits: []\n };\n\n const result = split_by_llm_categorize.fromFormData!(\n formData,\n originalNode\n );\n\n // Verify the call_llm action\n const callLlmAction = result.actions[0] as any;\n expect(callLlmAction.type).to.equal('call_llm');\n expect(callLlmAction.llm.uuid).to.equal(\n '1c06c884-39dd-4ce4-ad9f-9a01cbe6c000'\n );\n expect(callLlmAction.llm.name).to.equal('Claude');\n expect(callLlmAction.instructions).to.equal(\n '@(prompt(\"categorize\", slice(node.categories, 0, -2)))'\n );\n expect(callLlmAction.input).to.equal('@input');\n expect(callLlmAction.output_local).to.equal('_llm_output');\n\n // Verify the router structure\n const router = result.router!;\n expect(router.type).to.equal('switch');\n expect(router.operand).to.equal('@locals._llm_output');\n\n // Verify categories structure\n expect(router.categories).to.have.length(4);\n const categoryNames = router.categories.map((cat) => cat.name);\n expect(categoryNames).to.include.members([\n 'Flights',\n 'Hotels',\n 'Other',\n 'Failure'\n ]);\n\n // Verify cases structure\n expect(router.cases).to.have.length(3);\n const caseArguments = router.cases.map((c) => c.arguments[0]);\n expect(caseArguments).to.include.members([\n 'Flights',\n 'Hotels',\n '<ERROR>'\n ]);\n\n // Verify all cases use has_only_text\n router.cases.forEach((caseItem) => {\n expect(caseItem.type).to.equal('has_only_text');\n });\n\n // Verify exits match categories\n expect(result.exits).to.have.length(4);\n router.categories.forEach((category) => {\n const matchingExit = result.exits.find(\n (exit) => exit.uuid === category.exit_uuid\n );\n expect(matchingExit).to.exist;\n });\n\n // Verify default category is \"Other\"\n const otherCategory = router.categories.find(\n (cat) => cat.name === 'Other'\n );\n expect(router.default_category_uuid).to.equal(otherCategory!.uuid);\n });\n });\n});\n"]}
@@ -0,0 +1,150 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { split_by_random } from '../../src/flow/nodes/split_by_random';
3
+ import { NodeTest } from '../NodeHelper';
4
+ /**
5
+ * Test suite for the split_by_random node configuration.
6
+ */
7
+ describe('split_by_random node config', () => {
8
+ const helper = new NodeTest(split_by_random, 'split_by_random');
9
+ describe('basic properties', () => {
10
+ helper.testBasicProperties();
11
+ it('has correct name', () => {
12
+ expect(split_by_random.name).to.equal('Split by Random');
13
+ });
14
+ it('has correct type', () => {
15
+ expect(split_by_random.type).to.equal('split_by_random');
16
+ });
17
+ it('has correct color', () => {
18
+ expect(split_by_random.color).to.exist;
19
+ });
20
+ it('has router configuration', () => {
21
+ expect(split_by_random.router).to.exist;
22
+ expect(split_by_random.router.type).to.equal('random');
23
+ });
24
+ it('is a simple node config without form or layout', () => {
25
+ expect(split_by_random.form).to.be.undefined;
26
+ expect(split_by_random.layout).to.be.undefined;
27
+ expect(split_by_random.toFormData).to.be.undefined;
28
+ expect(split_by_random.fromFormData).to.be.undefined;
29
+ });
30
+ });
31
+ describe('node scenarios', () => {
32
+ helper.testNode({
33
+ uuid: 'test-random-node-1',
34
+ actions: [],
35
+ router: {
36
+ type: 'random',
37
+ categories: [
38
+ {
39
+ uuid: 'random-cat-1',
40
+ name: 'Bucket A',
41
+ exit_uuid: 'random-exit-1'
42
+ },
43
+ {
44
+ uuid: 'random-cat-2',
45
+ name: 'Bucket B',
46
+ exit_uuid: 'random-exit-2'
47
+ }
48
+ ]
49
+ },
50
+ exits: [
51
+ { uuid: 'random-exit-1', destination_uuid: null },
52
+ { uuid: 'random-exit-2', destination_uuid: null }
53
+ ]
54
+ }, { type: 'split_by_random' }, 'two-bucket-split');
55
+ helper.testNode({
56
+ uuid: 'test-random-node-2',
57
+ actions: [],
58
+ router: {
59
+ type: 'random',
60
+ categories: [
61
+ {
62
+ uuid: 'random-cat-1',
63
+ name: 'Group A',
64
+ exit_uuid: 'random-exit-1'
65
+ },
66
+ {
67
+ uuid: 'random-cat-2',
68
+ name: 'Group B',
69
+ exit_uuid: 'random-exit-2'
70
+ },
71
+ {
72
+ uuid: 'random-cat-3',
73
+ name: 'Group C',
74
+ exit_uuid: 'random-exit-3'
75
+ }
76
+ ]
77
+ },
78
+ exits: [
79
+ { uuid: 'random-exit-1', destination_uuid: null },
80
+ { uuid: 'random-exit-2', destination_uuid: null },
81
+ { uuid: 'random-exit-3', destination_uuid: null }
82
+ ]
83
+ }, { type: 'split_by_random' }, 'three-way-split');
84
+ helper.testNode({
85
+ uuid: 'test-random-node-3',
86
+ actions: [],
87
+ router: {
88
+ type: 'random',
89
+ categories: [
90
+ {
91
+ uuid: 'random-cat-1',
92
+ name: 'Treatment',
93
+ exit_uuid: 'random-exit-1'
94
+ },
95
+ {
96
+ uuid: 'random-cat-2',
97
+ name: 'Control',
98
+ exit_uuid: 'random-exit-2'
99
+ },
100
+ {
101
+ uuid: 'random-cat-3',
102
+ name: 'Variant A',
103
+ exit_uuid: 'random-exit-3'
104
+ },
105
+ {
106
+ uuid: 'random-cat-4',
107
+ name: 'Variant B',
108
+ exit_uuid: 'random-exit-4'
109
+ },
110
+ {
111
+ uuid: 'random-cat-5',
112
+ name: 'Holdout',
113
+ exit_uuid: 'random-exit-5'
114
+ }
115
+ ]
116
+ },
117
+ exits: [
118
+ { uuid: 'random-exit-1', destination_uuid: null },
119
+ { uuid: 'random-exit-2', destination_uuid: null },
120
+ { uuid: 'random-exit-3', destination_uuid: null },
121
+ { uuid: 'random-exit-4', destination_uuid: null },
122
+ { uuid: 'random-exit-5', destination_uuid: null }
123
+ ]
124
+ }, { type: 'split_by_random' }, 'ab-test-multiple-variants');
125
+ helper.testNode({
126
+ uuid: 'test-random-node-4',
127
+ actions: [],
128
+ router: {
129
+ type: 'random',
130
+ categories: [
131
+ {
132
+ uuid: 'random-cat-1',
133
+ name: 'Sample Group',
134
+ exit_uuid: 'random-exit-1'
135
+ },
136
+ {
137
+ uuid: 'random-cat-2',
138
+ name: 'Remaining Population',
139
+ exit_uuid: 'random-exit-2'
140
+ }
141
+ ]
142
+ },
143
+ exits: [
144
+ { uuid: 'random-exit-1', destination_uuid: null },
145
+ { uuid: 'random-exit-2', destination_uuid: null }
146
+ ]
147
+ }, { type: 'split_by_random' }, 'sampling-split');
148
+ });
149
+ });
150
+ //# sourceMappingURL=split_by_random.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split_by_random.test.js","sourceRoot":"","sources":["../../../test/nodes/split_by_random.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;IAEhE,QAAQ,CAAC,kBAAkB,EAAE,G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,SAAS,EAAE,eAAe;qBAC3B;oBACD;wBACE,IAAI,EAAE,cAAc;wBACpB,IAAI,EAAE,sBAAsB;wBAC5B,SAAS,EAAE,eAAe;qBAC3B;iBACF;aACF;YACD,KAAK,EAAE;gBACL,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE;gBACjD,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE;aAClD;SACM,EACT,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAC3B,gBAAgB,CACjB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { split_by_random } from '../../src/flow/nodes/split_by_random';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the split_by_random node configuration.\n */\ndescribe('split_by_random node config', () => {\n const helper = new NodeTest(split_by_random, 'split_by_random');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(split_by_random.name).to.equal('Split by Random');\n });\n\n it('has correct type', () => {\n expect(split_by_random.type).to.equal('split_by_random');\n });\n\n it('has correct color', () => {\n expect(split_by_random.color).to.exist;\n });\n\n it('has router configuration', () => {\n expect(split_by_random.router).to.exist;\n expect(split_by_random.router.type).to.equal('random');\n });\n\n it('is a simple node config without form or layout', () => {\n expect(split_by_random.form).to.be.undefined;\n expect(split_by_random.layout).to.be.undefined;\n expect(split_by_random.toFormData).to.be.undefined;\n expect(split_by_random.fromFormData).to.be.undefined;\n });\n });\n\n describe('node scenarios', () => {\n helper.testNode(\n {\n uuid: 'test-random-node-1',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Bucket A',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Bucket B',\n exit_uuid: 'random-exit-2'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'two-bucket-split'\n );\n\n helper.testNode(\n {\n uuid: 'test-random-node-2',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Group A',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Group B',\n exit_uuid: 'random-exit-2'\n },\n {\n uuid: 'random-cat-3',\n name: 'Group C',\n exit_uuid: 'random-exit-3'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null },\n { uuid: 'random-exit-3', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'three-way-split'\n );\n\n helper.testNode(\n {\n uuid: 'test-random-node-3',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Treatment',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Control',\n exit_uuid: 'random-exit-2'\n },\n {\n uuid: 'random-cat-3',\n name: 'Variant A',\n exit_uuid: 'random-exit-3'\n },\n {\n uuid: 'random-cat-4',\n name: 'Variant B',\n exit_uuid: 'random-exit-4'\n },\n {\n uuid: 'random-cat-5',\n name: 'Holdout',\n exit_uuid: 'random-exit-5'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null },\n { uuid: 'random-exit-3', destination_uuid: null },\n { uuid: 'random-exit-4', destination_uuid: null },\n { uuid: 'random-exit-5', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'ab-test-multiple-variants'\n );\n\n helper.testNode(\n {\n uuid: 'test-random-node-4',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Sample Group',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Remaining Population',\n exit_uuid: 'random-exit-2'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'sampling-split'\n );\n });\n});\n"]}
@@ -0,0 +1,150 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { wait_for_digits } from '../../src/flow/nodes/wait_for_digits';
3
+ import { NodeTest } from '../NodeHelper';
4
+ /**
5
+ * Test suite for the wait_for_digits node configuration.
6
+ */
7
+ describe('wait_for_digits node config', () => {
8
+ const helper = new NodeTest(wait_for_digits, 'wait_for_digits');
9
+ describe('basic properties', () => {
10
+ helper.testBasicProperties();
11
+ it('has correct name', () => {
12
+ expect(wait_for_digits.name).to.equal('Wait for Digits');
13
+ });
14
+ it('has correct type', () => {
15
+ expect(wait_for_digits.type).to.equal('wait_for_digits');
16
+ });
17
+ it('has correct color', () => {
18
+ expect(wait_for_digits.color).to.exist;
19
+ });
20
+ it('is a simple node config without form or layout', () => {
21
+ expect(wait_for_digits.form).to.be.undefined;
22
+ expect(wait_for_digits.layout).to.be.undefined;
23
+ expect(wait_for_digits.toFormData).to.be.undefined;
24
+ expect(wait_for_digits.fromFormData).to.be.undefined;
25
+ });
26
+ });
27
+ describe('node scenarios', () => {
28
+ helper.testNode({
29
+ uuid: 'test-digits-node-1',
30
+ actions: [],
31
+ router: {
32
+ type: 'switch',
33
+ wait: {
34
+ type: 'msg',
35
+ hint: {
36
+ type: 'digits',
37
+ count: 4
38
+ }
39
+ },
40
+ result_name: 'digits',
41
+ categories: [
42
+ {
43
+ uuid: 'digits-cat-1',
44
+ name: 'Has Number',
45
+ exit_uuid: 'digits-exit-1'
46
+ },
47
+ { uuid: 'digits-cat-2', name: 'Other', exit_uuid: 'digits-exit-2' }
48
+ ]
49
+ },
50
+ exits: [
51
+ { uuid: 'digits-exit-1', destination_uuid: null },
52
+ { uuid: 'digits-exit-2', destination_uuid: null }
53
+ ]
54
+ }, { type: 'wait_for_digits' }, 'basic-digits-wait');
55
+ helper.testNode({
56
+ uuid: 'test-digits-node-2',
57
+ actions: [],
58
+ router: {
59
+ type: 'switch',
60
+ wait: {
61
+ type: 'msg',
62
+ hint: {
63
+ type: 'digits',
64
+ count: 1
65
+ },
66
+ timeout: {
67
+ category_uuid: 'timeout-cat',
68
+ seconds: 30
69
+ }
70
+ },
71
+ result_name: 'pin_digit',
72
+ categories: [
73
+ {
74
+ uuid: 'digits-cat-1',
75
+ name: 'Has Number',
76
+ exit_uuid: 'digits-exit-1'
77
+ },
78
+ {
79
+ uuid: 'timeout-cat',
80
+ name: 'No Response',
81
+ exit_uuid: 'timeout-exit'
82
+ },
83
+ { uuid: 'digits-cat-2', name: 'Other', exit_uuid: 'digits-exit-2' }
84
+ ]
85
+ },
86
+ exits: [
87
+ { uuid: 'digits-exit-1', destination_uuid: null },
88
+ { uuid: 'timeout-exit', destination_uuid: null },
89
+ { uuid: 'digits-exit-2', destination_uuid: null }
90
+ ]
91
+ }, { type: 'wait_for_digits' }, 'single-digit-with-timeout');
92
+ helper.testNode({
93
+ uuid: 'test-digits-node-3',
94
+ actions: [],
95
+ router: {
96
+ type: 'switch',
97
+ wait: {
98
+ type: 'msg',
99
+ hint: {
100
+ type: 'digits',
101
+ count: 10
102
+ }
103
+ },
104
+ result_name: 'phone_number',
105
+ categories: [
106
+ {
107
+ uuid: 'phone-cat-1',
108
+ name: 'Valid Phone',
109
+ exit_uuid: 'phone-exit-1'
110
+ },
111
+ { uuid: 'phone-cat-2', name: 'Invalid', exit_uuid: 'phone-exit-2' },
112
+ { uuid: 'phone-cat-3', name: 'Other', exit_uuid: 'phone-exit-3' }
113
+ ]
114
+ },
115
+ exits: [
116
+ { uuid: 'phone-exit-1', destination_uuid: null },
117
+ { uuid: 'phone-exit-2', destination_uuid: null },
118
+ { uuid: 'phone-exit-3', destination_uuid: null }
119
+ ]
120
+ }, { type: 'wait_for_digits' }, 'phone-number-collection');
121
+ helper.testNode({
122
+ uuid: 'test-digits-node-4',
123
+ actions: [],
124
+ router: {
125
+ type: 'switch',
126
+ wait: {
127
+ type: 'msg',
128
+ hint: {
129
+ type: 'digits',
130
+ count: 6
131
+ }
132
+ },
133
+ result_name: 'verification_code',
134
+ categories: [
135
+ {
136
+ uuid: 'code-cat-1',
137
+ name: 'Valid Code',
138
+ exit_uuid: 'code-exit-1'
139
+ },
140
+ { uuid: 'code-cat-2', name: 'Other', exit_uuid: 'code-exit-2' }
141
+ ]
142
+ },
143
+ exits: [
144
+ { uuid: 'code-exit-1', destination_uuid: null },
145
+ { uuid: 'code-exit-2', destination_uuid: null }
146
+ ]
147
+ }, { type: 'wait_for_digits' }, 'verification-code');
148
+ });
149
+ });
150
+ //# sourceMappingURL=wait_for_digits.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait_for_digits.test.js","sourceRoot":"","sources":["../../../test/nodes/wait_for_digits.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;IAEhE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAE7B,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,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C/C,EAAE,IAAI,EAAE,aAAa,EAAE,gBAAgB,EAAE,IAAI,EAAE;aAChD;SACM,EACT,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAC3B,mBAAmB,CACpB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { wait_for_digits } from '../../src/flow/nodes/wait_for_digits';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the wait_for_digits node configuration.\n */\ndescribe('wait_for_digits node config', () => {\n const helper = new NodeTest(wait_for_digits, 'wait_for_digits');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(wait_for_digits.name).to.equal('Wait for Digits');\n });\n\n it('has correct type', () => {\n expect(wait_for_digits.type).to.equal('wait_for_digits');\n });\n\n it('has correct color', () => {\n expect(wait_for_digits.color).to.exist;\n });\n\n it('is a simple node config without form or layout', () => {\n expect(wait_for_digits.form).to.be.undefined;\n expect(wait_for_digits.layout).to.be.undefined;\n expect(wait_for_digits.toFormData).to.be.undefined;\n expect(wait_for_digits.fromFormData).to.be.undefined;\n });\n });\n\n describe('node scenarios', () => {\n helper.testNode(\n {\n uuid: 'test-digits-node-1',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits',\n count: 4\n }\n },\n result_name: 'digits',\n categories: [\n {\n uuid: 'digits-cat-1',\n name: 'Has Number',\n exit_uuid: 'digits-exit-1'\n },\n { uuid: 'digits-cat-2', name: 'Other', exit_uuid: 'digits-exit-2' }\n ]\n },\n exits: [\n { uuid: 'digits-exit-1', destination_uuid: null },\n { uuid: 'digits-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_digits' },\n 'basic-digits-wait'\n );\n\n helper.testNode(\n {\n uuid: 'test-digits-node-2',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits',\n count: 1\n },\n timeout: {\n category_uuid: 'timeout-cat',\n seconds: 30\n }\n },\n result_name: 'pin_digit',\n categories: [\n {\n uuid: 'digits-cat-1',\n name: 'Has Number',\n exit_uuid: 'digits-exit-1'\n },\n {\n uuid: 'timeout-cat',\n name: 'No Response',\n exit_uuid: 'timeout-exit'\n },\n { uuid: 'digits-cat-2', name: 'Other', exit_uuid: 'digits-exit-2' }\n ]\n },\n exits: [\n { uuid: 'digits-exit-1', destination_uuid: null },\n { uuid: 'timeout-exit', destination_uuid: null },\n { uuid: 'digits-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_digits' },\n 'single-digit-with-timeout'\n );\n\n helper.testNode(\n {\n uuid: 'test-digits-node-3',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits',\n count: 10\n }\n },\n result_name: 'phone_number',\n categories: [\n {\n uuid: 'phone-cat-1',\n name: 'Valid Phone',\n exit_uuid: 'phone-exit-1'\n },\n { uuid: 'phone-cat-2', name: 'Invalid', exit_uuid: 'phone-exit-2' },\n { uuid: 'phone-cat-3', name: 'Other', exit_uuid: 'phone-exit-3' }\n ]\n },\n exits: [\n { uuid: 'phone-exit-1', destination_uuid: null },\n { uuid: 'phone-exit-2', destination_uuid: null },\n { uuid: 'phone-exit-3', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_digits' },\n 'phone-number-collection'\n );\n\n helper.testNode(\n {\n uuid: 'test-digits-node-4',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits',\n count: 6\n }\n },\n result_name: 'verification_code',\n categories: [\n {\n uuid: 'code-cat-1',\n name: 'Valid Code',\n exit_uuid: 'code-exit-1'\n },\n { uuid: 'code-cat-2', name: 'Other', exit_uuid: 'code-exit-2' }\n ]\n },\n exits: [\n { uuid: 'code-exit-1', destination_uuid: null },\n { uuid: 'code-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_digits' },\n 'verification-code'\n );\n });\n});\n"]}
@@ -0,0 +1,171 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { wait_for_response } from '../../src/flow/nodes/wait_for_response';
3
+ import { NodeTest } from '../NodeHelper';
4
+ /**
5
+ * Test suite for the wait_for_response node configuration.
6
+ */
7
+ describe('wait_for_response node config', () => {
8
+ const helper = new NodeTest(wait_for_response, 'wait_for_response');
9
+ describe('basic properties', () => {
10
+ helper.testBasicProperties();
11
+ it('has correct name', () => {
12
+ expect(wait_for_response.name).to.equal('Wait for Response');
13
+ });
14
+ it('has correct type', () => {
15
+ expect(wait_for_response.type).to.equal('wait_for_response');
16
+ });
17
+ it('has form configuration', () => {
18
+ expect(wait_for_response.form).to.exist;
19
+ expect(wait_for_response.form.result_name).to.exist;
20
+ });
21
+ it('has layout configuration', () => {
22
+ expect(wait_for_response.layout).to.exist;
23
+ expect(wait_for_response.layout).to.deep.equal([
24
+ 'timeout',
25
+ 'result_name'
26
+ ]);
27
+ });
28
+ });
29
+ describe('node scenarios', () => {
30
+ helper.testNode({
31
+ uuid: 'test-wait-node-1',
32
+ actions: [],
33
+ router: {
34
+ type: 'switch',
35
+ wait: {
36
+ type: 'msg',
37
+ timeout: {
38
+ category_uuid: 'timeout-cat-1',
39
+ seconds: 300
40
+ }
41
+ },
42
+ result_name: 'response',
43
+ categories: [
44
+ {
45
+ uuid: 'timeout-cat-1',
46
+ name: 'No Response',
47
+ exit_uuid: 'timeout-exit-1'
48
+ }
49
+ ]
50
+ },
51
+ exits: [{ uuid: 'timeout-exit-1', destination_uuid: null }]
52
+ }, { type: 'wait_for_response' }, 'basic-wait');
53
+ helper.testNode({
54
+ uuid: 'test-wait-node-2',
55
+ actions: [],
56
+ router: {
57
+ type: 'switch',
58
+ wait: {
59
+ type: 'msg',
60
+ timeout: {
61
+ category_uuid: 'timeout-cat-2',
62
+ seconds: 1800
63
+ }
64
+ },
65
+ result_name: 'user_input',
66
+ categories: [
67
+ {
68
+ uuid: 'timeout-cat-2',
69
+ name: 'No Response',
70
+ exit_uuid: 'timeout-exit-2'
71
+ }
72
+ ]
73
+ },
74
+ exits: [{ uuid: 'timeout-exit-2', destination_uuid: null }]
75
+ }, { type: 'wait_for_response' }, 'custom-result-name');
76
+ helper.testNode({
77
+ uuid: 'test-wait-node-3',
78
+ actions: [],
79
+ router: {
80
+ type: 'switch',
81
+ wait: {
82
+ type: 'msg',
83
+ timeout: {
84
+ category_uuid: 'timeout-cat-3',
85
+ seconds: 60
86
+ }
87
+ },
88
+ result_name: 'quick_response',
89
+ categories: [
90
+ {
91
+ uuid: 'timeout-cat-3',
92
+ name: 'No Response',
93
+ exit_uuid: 'timeout-exit-3'
94
+ }
95
+ ]
96
+ },
97
+ exits: [{ uuid: 'timeout-exit-3', destination_uuid: null }]
98
+ }, { type: 'wait_for_response' }, 'short-timeout');
99
+ helper.testNode({
100
+ uuid: 'test-wait-node-4',
101
+ actions: [],
102
+ router: {
103
+ type: 'switch',
104
+ wait: {
105
+ type: 'msg'
106
+ // No timeout specified
107
+ },
108
+ result_name: 'response',
109
+ categories: []
110
+ },
111
+ exits: []
112
+ }, { type: 'wait_for_response' }, 'no-timeout');
113
+ });
114
+ describe('data transformation', () => {
115
+ it('converts node to form data correctly', () => {
116
+ const node = {
117
+ uuid: 'test-node',
118
+ actions: [],
119
+ router: {
120
+ type: 'switch',
121
+ result_name: 'user_response',
122
+ categories: []
123
+ },
124
+ exits: []
125
+ };
126
+ const formData = wait_for_response.toFormData(node);
127
+ expect(formData.uuid).to.equal('test-node');
128
+ expect(formData.result_name).to.equal('user_response');
129
+ });
130
+ it('converts form data to node correctly', () => {
131
+ var _a;
132
+ const formData = {
133
+ uuid: 'test-node',
134
+ result_name: 'custom_response'
135
+ };
136
+ const originalNode = {
137
+ uuid: 'test-node',
138
+ actions: [],
139
+ exits: [],
140
+ router: {
141
+ type: 'switch',
142
+ result_name: 'response',
143
+ categories: []
144
+ }
145
+ };
146
+ const result = wait_for_response.fromFormData(formData, originalNode);
147
+ expect(result.uuid).to.equal('test-node');
148
+ expect((_a = result.router) === null || _a === void 0 ? void 0 : _a.result_name).to.equal('custom_response');
149
+ });
150
+ it('handles default result name', () => {
151
+ var _a;
152
+ const formData = {
153
+ uuid: 'test-node'
154
+ // No result_name specified
155
+ };
156
+ const originalNode = {
157
+ uuid: 'test-node',
158
+ actions: [],
159
+ exits: [],
160
+ router: {
161
+ type: 'switch',
162
+ categories: []
163
+ }
164
+ };
165
+ const result = wait_for_response.fromFormData(formData, originalNode);
166
+ expect(result.uuid).to.equal('test-node');
167
+ expect((_a = result.router) === null || _a === void 0 ? void 0 : _a.result_name).to.equal('response');
168
+ });
169
+ });
170
+ });
171
+ //# sourceMappingURL=wait_for_response.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait_for_response.test.js","sourceRoot":"","sources":["../../../test/nodes/wait_for_response.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;IAEpE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAE7B,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,mBA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WAAW,CAAC,CAAC;YAC1C,MAAM,CAAC,MAAA,MAAM,CAAC,MAAM,0CAAE,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;;YACrC,MAAM,QAAQ,GAAG;gBACf,IAAI,EAAE,WAAW;gBACjB,2BAA2B;aAC5B,CAAC;YAEF,MAAM,YAAY,GAAS;gBACzB,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,EAAE;gBACX,KAAK,EAAE,EAAE;gBACT,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE,EAAE;iBACf;aACF,CAAC;YAEF,MAAM,MAAM,GAAG,iBAAiB,CAAC,YAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAEvE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC1C,MAAM,CAAC,MAAA,MAAM,CAAC,MAAM,0CAAE,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { wait_for_response } from '../../src/flow/nodes/wait_for_response';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the wait_for_response node configuration.\n */\ndescribe('wait_for_response node config', () => {\n const helper = new NodeTest(wait_for_response, 'wait_for_response');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(wait_for_response.name).to.equal('Wait for Response');\n });\n\n it('has correct type', () => {\n expect(wait_for_response.type).to.equal('wait_for_response');\n });\n\n it('has form configuration', () => {\n expect(wait_for_response.form).to.exist;\n expect(wait_for_response.form.result_name).to.exist;\n });\n\n it('has layout configuration', () => {\n expect(wait_for_response.layout).to.exist;\n expect(wait_for_response.layout).to.deep.equal([\n 'timeout',\n 'result_name'\n ]);\n });\n });\n\n describe('node scenarios', () => {\n helper.testNode(\n {\n uuid: 'test-wait-node-1',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n timeout: {\n category_uuid: 'timeout-cat-1',\n seconds: 300\n }\n },\n result_name: 'response',\n categories: [\n {\n uuid: 'timeout-cat-1',\n name: 'No Response',\n exit_uuid: 'timeout-exit-1'\n }\n ]\n },\n exits: [{ uuid: 'timeout-exit-1', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_response' },\n 'basic-wait'\n );\n\n helper.testNode(\n {\n uuid: 'test-wait-node-2',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n timeout: {\n category_uuid: 'timeout-cat-2',\n seconds: 1800\n }\n },\n result_name: 'user_input',\n categories: [\n {\n uuid: 'timeout-cat-2',\n name: 'No Response',\n exit_uuid: 'timeout-exit-2'\n }\n ]\n },\n exits: [{ uuid: 'timeout-exit-2', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_response' },\n 'custom-result-name'\n );\n\n helper.testNode(\n {\n uuid: 'test-wait-node-3',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n timeout: {\n category_uuid: 'timeout-cat-3',\n seconds: 60\n }\n },\n result_name: 'quick_response',\n categories: [\n {\n uuid: 'timeout-cat-3',\n name: 'No Response',\n exit_uuid: 'timeout-exit-3'\n }\n ]\n },\n exits: [{ uuid: 'timeout-exit-3', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_response' },\n 'short-timeout'\n );\n\n helper.testNode(\n {\n uuid: 'test-wait-node-4',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg'\n // No timeout specified\n },\n result_name: 'response',\n categories: []\n },\n exits: []\n } as Node,\n { type: 'wait_for_response' },\n 'no-timeout'\n );\n });\n\n describe('data transformation', () => {\n it('converts node to form data correctly', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n result_name: 'user_response',\n categories: []\n },\n exits: []\n };\n\n const formData = wait_for_response.toFormData!(node);\n\n expect(formData.uuid).to.equal('test-node');\n expect(formData.result_name).to.equal('user_response');\n });\n\n it('converts form data to node correctly', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'custom_response'\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: {\n type: 'switch',\n result_name: 'response',\n categories: []\n }\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n expect(result.uuid).to.equal('test-node');\n expect(result.router?.result_name).to.equal('custom_response');\n });\n\n it('handles default result name', () => {\n const formData = {\n uuid: 'test-node'\n // No result_name specified\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: {\n type: 'switch',\n categories: []\n }\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n expect(result.uuid).to.equal('test-node');\n expect(result.router?.result_name).to.equal('response');\n });\n });\n});\n"]}