fix(frontend): restore PublicView back-compat for tests + CI
Build & Push Docker Images / test-backend (push) Failing after 18s
Build & Push Docker Images / test-frontend (push) Successful in 22s
Build & Push Docker Images / build-backend (push) Has been skipped
Build & Push Docker Images / build-frontend (push) Has been skipped
Build & Push Docker Images / test-backend (push) Failing after 18s
Build & Push Docker Images / test-frontend (push) Successful in 22s
Build & Push Docker Images / build-backend (push) Has been skipped
Build & Push Docker Images / build-frontend (push) Has been skipped
The lifted screen-state refactor in PublicView broke App.test.jsx (5
failures): when no `onScreenChange` prop was passed, the click handler
called a no-op, so the screen never advanced from 'home' to 'search'
and the search input was never rendered.
Fix: make screen state uncontrolled-by-default. PublicView owns its
own `useState('home')` and uses the lifted props only when App.jsx
provides them. Same back-compat shape as before, BottomNav still
drives the screen via controlled props in the real app.
Also: vitest defaults to watch mode, which hangs the CI test step
forever. Updated docker.yaml to pass `--run --reporter=basic` so the
job exits with a real pass/fail signal.
Local verification: `npm test -- --run` → 6/6 passing.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,7 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: cd backend && npm ci
|
run: cd backend && npm ci
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cd backend && npm test
|
run: cd backend && npm test -- --run --reporter=basic
|
||||||
|
|
||||||
test-frontend:
|
test-frontend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -23,7 +23,7 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: cd frontend && npm ci
|
run: cd frontend && npm ci
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cd frontend && npm test
|
run: cd frontend && npm test -- --run --reporter=basic
|
||||||
|
|
||||||
build-backend:
|
build-backend:
|
||||||
needs: [ test-backend, test-frontend ]
|
needs: [ test-backend, test-frontend ]
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ function PublicView({
|
|||||||
screen: screenProp,
|
screen: screenProp,
|
||||||
onScreenChange,
|
onScreenChange,
|
||||||
}) {
|
}) {
|
||||||
// ponytail: screen state lifted to App.jsx so BottomNav can switch directly.
|
// ponytail: uncontrolled by default (own state); controlled when App.jsx passes props
|
||||||
const screen = screenProp ?? 'home';
|
// so BottomNav can drive the inner screen directly. No-op fallback breaks tests.
|
||||||
const setScreen = onScreenChange ?? (() => {});
|
const [internalScreen, setInternalScreen] = useState('home');
|
||||||
|
const screen = screenProp ?? internalScreen;
|
||||||
|
const setScreen = onScreenChange ?? setInternalScreen;
|
||||||
|
|
||||||
const [searchQuery, setSearchQuery] = useState('');
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
const [medicines, setMedicines] = useState([]);
|
const [medicines, setMedicines] = useState([]);
|
||||||
|
|||||||
Reference in New Issue
Block a user