-
Notifications
You must be signed in to change notification settings - Fork 4
/
test.sh
executable file
·33 lines (30 loc) · 1.1 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
test=$(
cat <<'EOF' | node ./index.js chunks-to-lines --linesFormat='"csv"' --nbLines='2' | sed 's/"id":"[0-9.]*"/"id":""/g'
{"payload": "A;B;C\n1;2;3\n"}
{"payload": "4;5;6\n7;8;9\n10;11;12\n", "complete": true}
{"tick": true}
{"tick": true}
{"payload": "D;E;F\n21;22;23\n24;25;26\n27;28;29\n30;31;32\n", "complete": true}
{"tick": true}
{"tick": true}
{"tick": true}
EOF
)
ref=$(
cat <<'EOF'
{"payload":"A;B;C\n1;2;3\n","_parts":{"id":"","type":"string","ch":"","index":0,"lines":2}}
{"payload":"A;B;C\n4;5;6\n7;8;9\n","_parts":{"id":"","type":"string","ch":"","index":1,"lines":4}}
{"payload":"A;B;C\n10;11;12\n","complete":true,"_parts":{"id":"","type":"string","ch":"","index":2,"count":3,"lines":5}}
{"payload":"D;E;F\n21;22;23\n","_parts":{"id":"","type":"string","ch":"","index":0,"lines":2}}
{"payload":"D;E;F\n24;25;26\n27;28;29\n","_parts":{"id":"","type":"string","ch":"","index":1,"lines":4}}
{"payload":"D;E;F\n30;31;32\n","complete":true,"_parts":{"id":"","type":"string","ch":"","index":2,"count":3,"lines":5}}
EOF
)
if [ "$test" = "$ref" ]; then
echo 'OK'
exit 0
else
echo 'ERROR'
exit 1
fi