-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathtest-multilingual.sh
More file actions
executable file
·138 lines (121 loc) · 3.96 KB
/
test-multilingual.sh
File metadata and controls
executable file
·138 lines (121 loc) · 3.96 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash
# Automated test suite for Jekyll Polyglot multilingual functionality
set -e # Exit on any error
SITE_DIR="_site"
BASE_URL="http://localhost:3000"
echo "🧪 Starting Missing Maps Multilingual Test Suite"
echo "=================================================="
# Test 1: Build verification
echo "📦 Test 1: Jekyll build verification"
bundle exec jekyll build --config _config.yml > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "✅ Jekyll build successful"
else
echo "❌ Jekyll build failed"
exit 1
fi
# Test 2: Language directory structure
echo "🌐 Test 2: Language directory structure"
LANGUAGES=("en" "fr" "es" "cs")
for lang in "${LANGUAGES[@]}"; do
if [ "$lang" = "en" ]; then
# English is at root
if [ -f "$SITE_DIR/index.html" ]; then
echo "✅ English root index.html exists"
else
echo "❌ English root index.html missing"
exit 1
fi
else
# Other languages in subdirs
if [ -f "$SITE_DIR/$lang/index.html" ]; then
echo "✅ $lang/index.html exists"
else
echo "❌ $lang/index.html missing"
exit 1
fi
if [ -f "$SITE_DIR/$lang/about/index.html" ]; then
echo "✅ $lang/about/index.html exists"
else
echo "❌ $lang/about/index.html missing"
exit 1
fi
fi
done
# Test 3: Translation content verification
echo "🔤 Test 3: Translation content verification"
# Test English (root)
actual=$(grep -o 'class="title feature-header">[^<]*' "$SITE_DIR/about/index.html" | cut -d'>' -f2)
if [ "$actual" = "About" ]; then
echo "✅ en/about title: '$actual'"
else
echo "❌ en/about title mismatch. Expected: 'About', Got: '$actual'"
exit 1
fi
# Test French
actual=$(grep -o 'class="title feature-header">[^<]*' "$SITE_DIR/fr/about/index.html" | cut -d'>' -f2)
if [ "$actual" = "À propos" ]; then
echo "✅ fr/about title: '$actual'"
else
echo "❌ fr/about title mismatch. Expected: 'À propos', Got: '$actual'"
exit 1
fi
# Test Spanish
actual=$(grep -o 'class="title feature-header">[^<]*' "$SITE_DIR/es/about/index.html" | cut -d'>' -f2)
if [ "$actual" = "Acerca de" ]; then
echo "✅ es/about title: '$actual'"
else
echo "❌ es/about title mismatch. Expected: 'Acerca de', Got: '$actual'"
exit 1
fi
# Test Czech
actual=$(grep -o 'class="title feature-header">[^<]*' "$SITE_DIR/cs/about/index.html" | cut -d'>' -f2)
if [ "$actual" = "O Missing Maps" ]; then
echo "✅ cs/about title: '$actual'"
else
echo "❌ cs/about title mismatch. Expected: 'O Missing Maps', Got: '$actual'"
exit 1
fi
# Test 4: Feed generation
echo "📡 Test 4: Feed generation verification"
for lang in "${LANGUAGES[@]}"; do
if [ "$lang" = "en" ]; then
feed_path="$SITE_DIR/feed.xml"
else
feed_path="$SITE_DIR/$lang/feed.xml"
fi
if [ -f "$feed_path" ]; then
echo "✅ $lang feed.xml exists"
else
echo "❌ $lang feed.xml missing"
exit 1
fi
done
# Test 5: Asset exclusion verification
echo "🚫 Test 5: Asset exclusion verification"
EXCLUDED_ITEMS=("node_modules" "package.json" "gulpfile.cjs")
for item in "${EXCLUDED_ITEMS[@]}"; do
if [ ! -e "$SITE_DIR/$item" ]; then
echo "✅ $item properly excluded"
else
echo "❌ $item should be excluded but exists in _site"
exit 1
fi
done
# Test 6: Polyglot configuration validation
echo "⚙️ Test 6: Polyglot configuration validation"
if grep -q "parallel_localization: true" _config.yml; then
echo "✅ Parallel localization enabled"
else
echo "❌ Parallel localization not enabled"
exit 1
fi
if grep -q 'languages: \["en", "fr", "cs", "es"\]' _config.yml; then
echo "✅ All languages configured"
else
echo "❌ Language configuration issue"
exit 1
fi
echo ""
echo "🎉 All tests passed! Multilingual functionality is working correctly."
echo "=================================================="