@nlighten/json-transform-core
Version:
Core types and utilities for handling JSON transformers
98 lines (97 loc) • 2.21 kB
JSON
[
{
"name": "Inline - parse CSV with comma as a value",
"given": {
"input": "a\n\",\"",
"inputFormat": "csv",
"definition": "$$csvparse:$"
},
"expect": {
"equal": [
{
"a": ","
}
]
}
},
{
"name": "Inline - parse CSV with escaped double quotes",
"given": {
"input": "a\n\"\"\"\"",
"inputFormat": "csv",
"definition": "$$csvparse:$"
},
"expect": {
"equal": [
{
"a": "\""
}
]
}
},
{
"name": "Inline - parse CSV into array format",
"given": {
"input": "1,2\n3,4",
"inputFormat": "csv",
"definition": "$$csvparse(true):$"
},
"expect": {
"equal": [
["1", "2"],
["3", "4"]
]
}
},
{
"name": "Object - parse CSV with comma as a value",
"given": {
"input": "a\n\",\"",
"inputFormat": "csv",
"definition": {
"$$csvparse": "$"
}
},
"expect": {
"equal": [
{
"a": ","
}
]
}
},
{
"name": "Object - parse CSV with escaped double quotes",
"given": {
"input": "a\n\"\"\"\"",
"inputFormat": "csv",
"definition": {
"$$csvparse": "$"
}
},
"expect": {
"equal": [
{
"a": "\""
}
]
}
},
{
"name": "Object - parse CSV with escaped double quotes",
"given": {
"input": "1,2\n3,4",
"inputFormat": "csv",
"definition": {
"$$csvparse": "$",
"no_headers": true
}
},
"expect": {
"equal": [
["1", "2"],
["3", "4"]
]
}
}
]