Remove client-side isLoggedIn value
[ProtonMail-WebClient.git] / packages / i18n / test / test-linter.sh
blobb6066c0a1ae1dccaff92a987bd86ef9841e83999
1 #!/usr/bin/env bash
3 set -eo pipefail
5 readonly TEST_FILES='test/input/js';
7 function main {
9 local hasError=false;
11 for file in "$TEST_FILES"/*; do
13 echo "[~] validate ${file}";
15 local expectedFile="$(sed 's/\.js$//; s/input/output/' <<< "$file")";
16 local output="$(FORCE_COLOR=0 node scripts/linter.mjs "$file")";
17 local expectedOutput="$(cat "$expectedFile")";
19 if [ "$expectedOutput" != "$output" ]; then
20 hasError=true;
21 echo -e " 💥 \e[1m\e[31mError\e[39m\e[0m wrong output for ${file}"
22 echo -e "\e[4m🤖 Output\e[0m:"
23 echo "$(echo "$output")";
24 echo
25 echo -e "\e[4m🤖 Expected\e[0m:"
26 echo "$expectedOutput";
28 echo
29 echo '-----------------[DIFF]-----------------------'
30 echo
31 diff -rupP <(echo "$output") <(echo "$expectedOutput")
32 echo
33 echo '-----------------[/DIFF]-----------------------'
34 exit
35 else
36 echo -e "\e[32m ✔ lint translations for ${file}\e[0m";
37 fi;
39 done
41 if "$hasError"; then
42 return 1
46 main