mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-21 14:21:46 +00:00
Derive client domain types from the shared schema contracts
Add entity/response Zod schemas to @trek/shared (place, trip, assignment, day, budget, packing, reservation), each matched against the producing server service, and re-export them from client types.ts instead of the hand-written duplicates that had drifted (name/title, amount/total_price, owner_id/user_id, cover_url/cover_image, ...). Updates the call sites and test fixtures the corrected types surfaced; type-only, no runtime behaviour change.
This commit is contained in:
@@ -201,14 +201,14 @@ describe('tripStore', () => {
|
||||
|
||||
describe('updateTrip', () => {
|
||||
it('FE-TRIP-008: updateTrip persists and refreshes trip + days', async () => {
|
||||
const updatedTrip = buildTrip({ id: 1, name: 'Updated Trip' });
|
||||
const updatedTrip = buildTrip({ id: 1, title: 'Updated Trip' });
|
||||
|
||||
server.use(
|
||||
http.put('/api/trips/1', () => HttpResponse.json({ trip: updatedTrip })),
|
||||
http.get('/api/trips/1/days', () => HttpResponse.json({ days: [] })),
|
||||
);
|
||||
|
||||
const result = await useTripStore.getState().updateTrip(1, { name: 'Updated Trip' });
|
||||
const result = await useTripStore.getState().updateTrip(1, { title: 'Updated Trip' });
|
||||
|
||||
expect(result).toEqual(updatedTrip);
|
||||
expect(useTripStore.getState().trip).toEqual(updatedTrip);
|
||||
|
||||
Reference in New Issue
Block a user