Post date

This commit is contained in:
Dejvino
2026-07-30 18:19:38 +02:00
parent c283c47cef
commit ebc2de4190
3 changed files with 25 additions and 1 deletions
+12
View File
@@ -97,6 +97,18 @@ assert_eq "trailing slash: exit code" "0" "$?"
REQ=$(cat "$MOCK_WP_REQUEST_FILE")
assert_eq "trailing slash: path has no double slash" "/wp-json/wp/v2/posts/" "$(jq -r '.path' <<<"$REQ")"
# --- --date backdates the post via date_gmt ---
rm -f "$MOCK_WP_REQUEST_FILE" "$MOCK_WP_CONTROL_FILE"
run_post_sh --file "$POST_FILE" --date "2026-07-27T10:00:00Z" >/dev/null
assert_eq "date: exit code" "0" "$?"
REQ=$(cat "$MOCK_WP_REQUEST_FILE")
assert_eq "date: date_gmt sent, trailing Z stripped" "2026-07-27T10:00:00" "$(jq -r '.payload.date_gmt' <<<"$REQ")"
rm -f "$MOCK_WP_REQUEST_FILE" "$MOCK_WP_CONTROL_FILE"
run_post_sh --file "$POST_FILE" >/dev/null
REQ=$(cat "$MOCK_WP_REQUEST_FILE")
assert_eq "no date: date_gmt omitted" "true" "$(jq -r '.payload | has("date_gmt") | not' <<<"$REQ")"
# --- edit an existing post ---
rm -f "$MOCK_WP_REQUEST_FILE" "$MOCK_WP_CONTROL_FILE"
run_post_sh --file "$POST_FILE" --edit 99 >/dev/null