Repository navigation
fix(negocios): PUT/DELETE URL mismatch and add E2E CRUD coverage - #7
Merged
Merged
Conversation
- Fix /api/negocios PUT and DELETE to read id from ?id= query param (route.ts was parsing pathname but clients called /api/negocios/:id). - Update NegocioForm edit URL to /api/negocios?id=... - Update NegocioDetailModal delete URL to /api/negocios?id=... - Extend createNegocio E2E helper with referencia, linkUbicacion, horaApertura. - Add e2e/negocios-crud.spec.ts covering admin CRUD from /clientes: create, detail modal, edit from detail, edit from card, Ver pedidos link, delete, and delete-blocked when negocio has pedidos. Verification: - npx tsc --noEmit ✅ - npm run test -- --run ✅ 1836 passed - npx playwright test e2e/negocios-crud.spec.ts --project=chromium ✅ 7 passed
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3 tasks
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes a critical bug where negocio edit and delete from the UI were failing silently with "Error de conexión", and adds full E2E CRUD coverage for the negocio section.
Bug root cause
src/app/api/negocios/route.tsPUT/DELETE handlers extracted the negocio id fromurl.pathname.split('/').pop().NegocioFormandNegocioDetailModal) called/api/negocios/:id(path param)./api/negocios/[id]/route.tsfile, so those requests hit a 404 andres.json()threw → "Error de conexión".Fix
idfrom?id=query param./api/negocios?id=...for PUT and DELETE.New E2E test
e2e/negocios-crud.spec.tscovers all admin UI contexts:/pedidos?clienteId=....Verification
npx tsc --noEmit✅npm run test -- --run✅ 1836 passednpx playwright test e2e/negocios-crud.spec.ts --project=chromium✅ 7 passedFiles changed
src/app/api/negocios/route.tssrc/components/negocio-form.tsxsrc/components/negocio-detail-modal.tsxe2e/fixtures.tse2e/negocios-crud.spec.ts(new)