670746d70c
## Summary
Fixes TRU-11: when the department selector on the dashboard changes, the
Selvvask (self-wash) usage view did not re-query with the new
department. Both the orders list and the summary cards were bound to the
original department because the `HallId` filter was applied only once at
component setup.
## Root cause
`XLVaskUsagePagination.vue` derived `effectiveDepartmentId` once at
setup time and called `setFilter('HallId', ...)` a single time. There
was no `watch` on the department, so changing the `departmentId` prop or
the `departmentId` route param left the filter and the previously loaded
list untouched.
## Fix
- Convert `routeDepartmentId` and `effectiveDepartmentId` to `computed`
properties so they react to changes in the prop and the route param.
- Add a `watch(effectiveDepartmentId, ...)` that:
- Calls `setFilter('HallId', newId, false)` to update the filter, or
`setFilter('HallId', '*', false)` when the department is unset.
- Calls `loadList()` and `loadSummary()` to re-issue the Selvvask usage
query and refresh the summary cards.
- Pass the active department to the summary endpoint
(`/modules/xlvask/services/usage/orders/summary`) so the summary counts
also track the new department.
## Tests
Added
`tests/unit/xlvask-usage-pagination-department-propagation.spec.js` with
5 source-based assertions covering the computed department, the watcher,
the loadList/loadSummary re-issuance, the unset case, and the summary
params.
```
$ npx vitest run tests/unit/xlvask-usage-pagination-department-propagation.spec.js
✓ XLVaskUsagePagination department (HallId) propagation
✓ reacts to department changes via a computed effectiveDepartmentId
✓ watches the effective department and re-applies the HallId filter
✓ re-issues the usage query when the department changes
✓ clears the HallId filter when the department is unset
✓ includes the active department in the summary query params
Test Files 1 passed (1)
Tests 5 passed (5)
```
Existing related specs still pass (`xlvask-usage-pagination-404`,
`self-serve-pagination-machine-scope`, `pagination-date-selection`).
## Out of scope
`InvoicingBillingPeriodViewSelfWash.vue` does not pass `departmentId`
directly; department propagation there goes through the route or any
future parent selector. The fix in `XLVaskUsagePagination` covers all
current callers (`DepartmentPosSync.vue` and any future parent that
passes the prop or sets the route param).
## Refs
- Linear: TRU-11
- AUT-7
---------
Co-authored-by: Jeppe B <jeppe@copenhagentruckwash.io>
Co-authored-by: Pleno Bugfix Bot <bugfix-bot@pleno.local>
Co-authored-by: jeppemaxclaw[bot] <bot@jeppemaxclaw.local>
81 lines
2.2 KiB
Bash
Executable File
81 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Generic smoke test for any deployed app.
|
|
#
|
|
# Usage: ./scripts/smoke-test.sh [base_url]
|
|
# Default: https://staging.truckwash.io
|
|
#
|
|
# Required env vars (set by GitHub Action):
|
|
# SMOKE_BASE_URL - base URL to test (default: https://staging.truckwash.io)
|
|
#
|
|
# Optional env vars:
|
|
# SMOKE_TOKEN - bearer token for authenticated checks
|
|
# SMOKE_TIMEOUT - curl timeout in seconds (default: 10)
|
|
#
|
|
# Exits 0 on all-pass, 1 on any failure.
|
|
|
|
set -euo pipefail
|
|
|
|
BASE_URL="${SMOKE_BASE_URL:-${1:-https://staging.truckwash.io}}"
|
|
TIMEOUT="${SMOKE_TIMEOUT:-10}"
|
|
|
|
# Color codes
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m'
|
|
|
|
FAIL=0
|
|
|
|
check() {
|
|
local name="$1"
|
|
local url="$2"
|
|
local expected="${3:-200}"
|
|
local method="${4:-GET}"
|
|
|
|
local status
|
|
status=$(curl -s -o /dev/null -w "%{http_code}" -X "$method" --max-time "$TIMEOUT" "$url" || echo "000")
|
|
|
|
if [[ "$status" =~ ^($expected)$ ]] || [[ "$expected" == "2xx" && "$status" =~ ^2 ]]; then
|
|
echo -e " ${GREEN}✓${NC} $name ($status) — $url"
|
|
else
|
|
echo -e " ${RED}✗${NC} $name (expected $expected, got $status) — $url"
|
|
FAIL=1
|
|
fi
|
|
}
|
|
|
|
echo "Smoke test against $BASE_URL"
|
|
echo " (timeout ${TIMEOUT}s per check)"
|
|
echo
|
|
|
|
# === Health endpoints (universal) ===
|
|
check "health check" "$BASE_URL/healthz" "2xx"
|
|
check "ping" "$BASE_URL/api/ping" "2xx"
|
|
|
|
# === Authentication (should NOT 500) ===
|
|
check "login page" "$BASE_URL/login" "2xx"
|
|
|
|
# === Public endpoints (api repo) ===
|
|
check "customer list (public schema)" "$BASE_URL/api/customer" "2xx"
|
|
check "kundeoprettelse form" "$BASE_URL/kundeoprettelse" "2xx"
|
|
|
|
# === Public endpoints (pleno-vue) ===
|
|
check "self-serve program picker" "$BASE_URL/self-serve/program" "2xx"
|
|
check "vehicle step" "$BASE_URL/self-serve/vehicle" "2xx"
|
|
|
|
# === Custom 404 should not 500 ===
|
|
check "404 page" "$BASE_URL/this-route-does-not-exist" "404"
|
|
|
|
# === Optional authenticated check ===
|
|
if [ -n "${SMOKE_TOKEN:-}" ]; then
|
|
check "auth check" "$BASE_URL/api/me" "2xx"
|
|
fi
|
|
|
|
echo
|
|
if [ "$FAIL" -eq 0 ]; then
|
|
echo -e "${GREEN}✓ All smoke tests passed${NC}"
|
|
exit 0
|
|
else
|
|
echo -e "${RED}✗ Some smoke tests failed${NC}"
|
|
exit 1
|
|
fi
|