增加公司选项
This commit is contained in:
@@ -666,6 +666,52 @@ describe('ReservationManualInvoiceView', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('prefills KANGLER TRAVEL directory data and submits its stable recipient codes', async () => {
|
||||
vi.mocked(service.generateManualReservationInvoice).mockResolvedValue(createResult())
|
||||
const wrapper = mountView()
|
||||
|
||||
await wrapper.find('[data-testid="recipient-company-code"]').setValue('KANGLER_TRAVEL')
|
||||
|
||||
expect((wrapper.find('[data-testid="recipient-contact-id"]').element as HTMLSelectElement).value).toBe(
|
||||
'KANGLER_TRAVEL_KHUN_DOW',
|
||||
)
|
||||
expect((wrapper.find('[data-testid="recipient-company-input"]').element as HTMLInputElement).value).toBe(
|
||||
'KANGLER TRAVEL GROUP CO.,LTD',
|
||||
)
|
||||
expect((wrapper.find('[data-testid="recipient-attention-input"]').element as HTMLInputElement).value).toBe(
|
||||
'Khun Dow',
|
||||
)
|
||||
expect((wrapper.find('[data-testid="recipient-address"]').element as HTMLTextAreaElement).value).toBe(
|
||||
'เลขที่290/27, Soi Ladprao 84, Wangthonglang,Bangkok,10310',
|
||||
)
|
||||
expect((wrapper.find('[data-testid="recipient-telephone"]').element as HTMLInputElement).value).toBe(
|
||||
'081-1237170',
|
||||
)
|
||||
expect((wrapper.find('[data-testid="recipient-email"]').element as HTMLInputElement).value).toBe(
|
||||
'kanglertravel.op91@gmail.com',
|
||||
)
|
||||
|
||||
await fillMinimumInvoiceForm(wrapper)
|
||||
await wrapper.find('[data-testid="manual-invoice-submit"]').trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
expect(service.generateManualReservationInvoice).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
invoice_payload: expect.objectContaining({
|
||||
recipient: expect.objectContaining({
|
||||
company_code: 'KANGLER_TRAVEL',
|
||||
contact_id: 'KANGLER_TRAVEL_KHUN_DOW',
|
||||
company: 'KANGLER TRAVEL GROUP CO.,LTD',
|
||||
attention: 'Khun Dow',
|
||||
address: 'เลขที่290/27, Soi Ladprao 84, Wangthonglang,Bangkok,10310',
|
||||
telephone: '081-1237170',
|
||||
email: 'kanglertravel.op91@gmail.com',
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('downloads the generated PDF through a browser blob URL', async () => {
|
||||
vi.mocked(service.generateManualReservationInvoice).mockResolvedValue(createResult())
|
||||
const fetchMock = vi.fn().mockResolvedValue({
|
||||
|
||||
@@ -909,6 +909,19 @@ const recipientCompanies: RecipientCompanySeed[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
company_code: 'KANGLER_TRAVEL',
|
||||
company: 'KANGLER TRAVEL GROUP CO.,LTD',
|
||||
contacts: [
|
||||
{
|
||||
contact_id: 'KANGLER_TRAVEL_KHUN_DOW',
|
||||
attention: 'Khun Dow',
|
||||
address: 'เลขที่290/27, Soi Ladprao 84, Wangthonglang,Bangkok,10310',
|
||||
telephone: '081-1237170',
|
||||
email: 'kanglertravel.op91@gmail.com',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
company_code: 'HANATOUR',
|
||||
company: 'HANATOUR TD CO., LTD.',
|
||||
|
||||
Reference in New Issue
Block a user