| 12345678910111213141516171819202122232425 |
- {
- "name": "verify-utils-get-field-value",
- "nodes": [
- {"id": "n1", "name": "Trigger", "type": "click-trigger", "position": {"x": 0, "y": 0}, "config": {}},
- {"id": "n2", "name": "Probe", "type": "code", "position": {"x": 0, "y": 100},
- "config": {"code": "const d = { a: { b: { c: 7 } }, list: [{ id: 'x' }, { id: 'y' }], flat: [10, 20, 30] };\nconst g = smartbotic.utils.getFieldValue;\nreturn {\n nested: g(d, 'a.b.c'),\n bracket: g(d, 'list[1].id'),\n numeric: g(d, 'flat.2'),\n length: g(d, 'flat.length'),\n missing: g(d, 'a.nope.c') === undefined,\n throughNull: g({ a: null }, 'a.b') === undefined,\n emptyPath: g(d, '').a.b.c,\n notAnObject: g(d, 'a.b.c.d') === undefined,\n hugeBracket: g(d, 'flat[99999999999999999999]') === undefined,\n hugeNumeric: g(d, 'flat.99999999999999999999') === undefined\n};"}}
- ],
- "connections": [
- {"sourceNodeId": "n1", "sourceOutput": "main", "targetNodeId": "n2", "targetInput": "data"}
- ],
- "expect": {
- "n2": {"status": "completed", "output": {"result": {
- "nested": 7,
- "bracket": "y",
- "numeric": 30,
- "length": 3,
- "missing": true,
- "throughNull": true,
- "emptyPath": 7,
- "notAnObject": true,
- "hugeBracket": true,
- "hugeNumeric": true
- }}}
- }
- }
|