Post date
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user