实现酒店上下文单酒店收口

This commit is contained in:
andy
2026-07-10 15:31:51 +08:00
parent 7492c21350
commit d69f3975ef
52 changed files with 1183 additions and 188 deletions

View File

@@ -72,7 +72,7 @@ describe('reservationService real API mode', () => {
})
expect(fetchMock).toHaveBeenCalledWith(
'/api/reservation/tasks?hotel_id=HOTEL-TEST&task_status=PENDING_CONFIRM&order_status=ACTIVE&page_num=1&page_size=20',
'/api/reservation/tasks?task_status=PENDING_CONFIRM&order_status=ACTIVE&page_num=1&page_size=20',
expect.objectContaining({ method: 'GET' }),
)
expect(result.items).toHaveLength(1)
@@ -99,12 +99,12 @@ describe('reservationService real API mode', () => {
})
expect(fetchMock).toHaveBeenCalledWith(
'/api/reservation/tasks?hotel_id=HOTEL-TEST&task_subtype=RATE_CHANGE&task_status=FAILED&page_num=1&page_size=20',
'/api/reservation/tasks?task_subtype=RATE_CHANGE&task_status=FAILED&page_num=1&page_size=20',
expect.objectContaining({ method: 'GET' }),
)
})
it('uses the selected auth hotel before falling back to the environment hotel id', async () => {
it('uses the selected auth hotel when available', async () => {
const fetchMock = vi.spyOn(globalThis, 'fetch').mockResolvedValue(
mockJsonResponse({
items: [],
@@ -162,7 +162,7 @@ describe('reservationService real API mode', () => {
})
expect(fetchMock).toHaveBeenCalledWith(
'/api/reservation/orders?hotel_id=HOTEL-TEST&keyword=GRP-001&page_num=1&page_size=20',
'/api/reservation/orders?keyword=GRP-001&page_num=1&page_size=20',
expect.objectContaining({ method: 'GET' }),
)
expect(result.items[0]?.display_order_key).toBe('GRP-001')
@@ -191,7 +191,7 @@ describe('reservationService real API mode', () => {
})
expect(fetchMock).toHaveBeenCalledWith(
'/api/reservation/orders?hotel_id=HOTEL-TEST&order_status=LOGIC_DELETED&group_code=GRP-001&confirmation_number=CNF-001&keyword=VIP&page_num=2&page_size=10',
'/api/reservation/orders?order_status=LOGIC_DELETED&group_code=GRP-001&confirmation_number=CNF-001&keyword=VIP&page_num=2&page_size=10',
expect.objectContaining({ method: 'GET' }),
)
})
@@ -257,7 +257,7 @@ describe('reservationService real API mode', () => {
const result = await fetchReservationOrderDetail('20001')
expect(fetchMock).toHaveBeenCalledWith(
'/api/reservation/orders/20001?hotel_id=HOTEL-TEST&include_tasks=true&include_source_summary=true',
'/api/reservation/orders/20001?include_tasks=true&include_source_summary=true',
expect.objectContaining({ method: 'GET' }),
)
expect(result.order.display_name).toBe('GRP-001')