Remove client-side isLoggedIn value
[ProtonMail-WebClient.git] / packages / i18n / test / test-validator.sh
blobd22a13b4cef0459ec58d1173e30ed85ba50aabaa
1 #!/usr/bin/env bash
3 set -eo pipefail
5 readonly TEST_FILES='test/input/po';
7 function main {
8 # $ for file in test/po/*; do
10 # I18N_TEMPLATE_FILE="$file" node index validate > "test/output/po/$(basename "$file")";
12 # done;
14 local hasError=false;
16 for file in "$TEST_FILES"/*; do
18 echo "[~] validate ${file}";
20 local expectedFile="$(sed 's/input/output/' <<< "$file")";
21 local output="$(FORCE_COLOR=0 I18N_TEMPLATE_FILE="$file" node index validate)";
22 local expectedOutput="$(cat "$expectedFile")";
24 if [ "$expectedOutput" != "$output" ]; then
25 hasError=true;
26 echo -e " 💥 \e[1m\e[31mError\e[39m\e[0m wrong output for ${file}"
27 echo -e "\e[4m🤖 Output\e[0m:"
28 echo "$(echo "$output")";
29 echo
30 echo -e "\e[4m🤖 Expected\e[0m:"
31 echo "$expectedOutput";
33 echo
34 echo '-----------------[DIFF]-----------------------'
35 echo
36 diff -rupP <(echo "$output") <(echo "$expectedOutput")
37 echo
38 echo '-----------------[/DIFF]-----------------------'
39 exit
40 else
41 echo -e "\e[32m ✔ lint translations for ${file}\e[0m";
42 fi;
44 done
46 if "$hasError"; then
47 return 1
51 main