orcli/tests/export-tsv-facets.sh

28 lines
676 B
Bash
Raw Normal View History

2023-01-27 18:04:27 +01:00
#!/bin/bash
t="export-tsv-facets"
# create tmp directory
tmpdir="$(mktemp -d)"
trap '{ rm -rf "${tmpdir}"; }' 0 2 3 15
# input
cp data/duplicates.csv "${tmpdir}/${t}.csv"
# assertion
cat << "DATA" > "${tmpdir}/${t}.assert"
email name state gender purchase
ben.tyler@example3.org Ben Tyler NV M Flashlight
ben.morisson@example6.org Ben Morisson FL M Amplifier
DATA
# action
cd "${tmpdir}" || exit 1
orcli import csv "${t}.csv" --projectName "${t}"
orcli export tsv "${t}" \
--output "${t}.output" \
--facets '[ { "type": "text", "name": "foo", "columnName": "name", "mode": "regex", "caseSensitive": false, "query": "Ben" } ]'
# test
diff -u "${t}.assert" "${t}.output"