aboutsummaryrefslogtreecommitdiff
path: root/scripts/assert-content.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/assert-content.sh')
-rwxr-xr-xscripts/assert-content.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh
index ee028a6..da73e65 100755
--- a/scripts/assert-content.sh
+++ b/scripts/assert-content.sh
@@ -58,6 +58,10 @@ get-title() {
echo "${1}" | base64 --decode | jq -r .title
}
+get-layout() {
+ echo "${1}" | base64 --decode | jq -r .layout
+}
+
LANGS=(en pt fr)
IGNORED_PAGES=(site.json sitemap.xml *.atom)
@@ -144,4 +148,22 @@ assert-unique-ref "$(jq -r '.pages[] | @base64' "${JSON}")"
assert-unique-ref "$(jq -r '.posts[] | @base64' "${JSON}")"
assert-unique-ref "$(jq -r '.tils[] | @base64' "${JSON}")"
+echo Asserting layouts... >&2
+assert-layout() {
+ DESIRED=$2
+ for p in $1; do
+ LAYOUT="$(get-layout "$p")"
+ URL="$(get-url "$p")"
+ if [[ "${DESIRED}" != "${LAYOUT}" ]]; then
+ red "Layout mismatch: expected '${DESIRED}', got '${LAYOUT}'."
+ red "Page: ${URL}."
+ # exit 1
+ fi
+ done
+}
+
+assert-layout "$(jq -r '.posts[] | @base64' "${JSON}")" "post"
+assert-layout "$(jq -r '.pastebins[] | @base64' "${JSON}")" "pastebin"
+assert-layout "$(jq -r '.tils[] | @base64' "${JSON}")" "til"
+
echo Done. >&2