实现酒店上下文单酒店收口
This commit is contained in:
@@ -77,6 +77,29 @@ describe('debugEmlService', () => {
|
||||
expect(result.debug_run_id).toBe('90001')
|
||||
})
|
||||
|
||||
it('omits hotel id when debug upload does not choose a hotel', async () => {
|
||||
const fetchMock = vi.spyOn(globalThis, 'fetch').mockResolvedValue(
|
||||
mockJsonResponse({
|
||||
debug_run_id: '90002',
|
||||
source_message_id: null,
|
||||
uploaded_media: [],
|
||||
warnings: [],
|
||||
status: 'CREATED',
|
||||
}),
|
||||
)
|
||||
const file = new File(['From: guest@example.test'], 'booking.eml', { type: 'message/rfc822' })
|
||||
|
||||
await uploadDebugEmlSuperAgentRun({
|
||||
debugUploadKey: 'manual-debug-key',
|
||||
file,
|
||||
})
|
||||
|
||||
const [, init] = fetchMock.mock.calls[0]!
|
||||
const formData = init?.body as FormData
|
||||
expect(formData.has('hotel_id')).toBe(false)
|
||||
expect(formData.get('file')).toBe(file)
|
||||
})
|
||||
|
||||
it('throws a typed safe error for backend error_code responses', async () => {
|
||||
const unauthorizedHandler = vi.fn()
|
||||
setUnauthorizedHandler(unauthorizedHandler)
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user