UNPKG

@nlighten/json-transform-core

Version:

Core types and utilities for handling JSON transformers

88 lines (87 loc) 1.93 kB
[ { "name": "Object - simple value extraction", "given": { "input": { "value": "bbb" }, "definition": { "a": "$$value:$.value", "b": "$$value:$.b", "c": { "$$value": [] }, "d": { "$$value": {} } } }, "expect": { "equal": { "a": "bbb" } } }, { "name": "ObjectStreams - non-empty array", "given": { "input": [1, 2, 3], "definition": { "a": "$$value:$" } }, "expect": { "equal": { "a": [1, 2, 3] } } }, { "name": "ObjectStreams - empty array", "given": { "input": [], "definition": { "a": "$$value:$" } }, "expect": { "equal": {} } }, { "name": "ObjectStreams - mapping over non-empty array", "given": { "input": [1, 2, 3], "definition": { "a": { "$$value": { "$$map": "$", "to": "##current" } } } }, "expect": { "equal": { "a": [1, 2, 3] } } }, { "name": "ObjectStreams - mapping over empty array", "given": { "input": [], "definition": { "a": { "$$value": { "$$map": "$", "to": "##current" } } } }, "expect": { "equal": {} } } ]