This commit is contained in:
2026-09-09 17:42:19 +08:00
parent a47a7e9767
commit 2fd9c5fcc7
8 changed files with 39 additions and 7 deletions
@@ -72,6 +72,7 @@ const domesticWarehouse: PlatformWarehouseSummaryResource = {
id: '19001',
tenantId: 0,
warehouseCode: 'CN-YW-01',
internalCode: null,
warehouseName: '义乌收货仓',
warehouseType: 'DOMESTIC',
countryCode: 'CN',
@@ -106,6 +107,7 @@ const fbaWarehouse: PlatformWarehouseSummaryResource = {
id: '19011',
tenantId: 0,
warehouseCode: 'AKR1',
internalCode: '154',
warehouseName: 'AKR1',
warehouseType: 'FBA',
countryCode: 'US',
@@ -130,6 +132,7 @@ const partnerWarehouse: PlatformWarehouseSummaryResource = {
...fbaWarehouse,
id: '19021',
warehouseCode: 'PARTNER-US-01',
internalCode: null,
warehouseName: '洛杉矶合作仓',
warehouseType: 'OVERSEAS_PARTNER',
}
@@ -196,7 +199,7 @@ describe('WarehousesView', () => {
expect(warehousesSource).toMatch(/size="small"\s+plain\s+:type=/)
expect(warehousesSource).toContain('<Pencil :size="15" />')
expect(warehousesSource).toContain('<Power :size="15" />')
for (const label of ['仓库名称', '仓库编码', '州/省', '城市', '邮编']) expect(warehousesSource).toContain(`label: '${label}'`)
for (const label of ['仓库名称', '仓库编码', '内部编号', '州/省', '城市', '邮编']) expect(warehousesSource).toContain(`label: '${label}'`)
expect(warehousesSource).toContain('@media (max-width: 720px)')
})
it('uses the prototype-sized centered warehouse editor with a fixed footer', () => {
@@ -333,6 +336,7 @@ describe('WarehousesView', () => {
expect(stateSelect).toBeDefined()
setField('input[placeholder="例如 LAX9"]', 'lax9')
setField('input[placeholder="例如 154 或 CADF"]', '154')
stateSelect!.vm.$emit('update:modelValue', 'CA')
stateSelect!.vm.$emit('change', 'CA')
await flushPromises()
@@ -347,6 +351,7 @@ describe('WarehousesView', () => {
expect(createFbaWarehouse).toHaveBeenCalledWith({
warehouseCode: 'LAX9',
internalCode: '154',
stateProvince: 'CA',
city: 'Long Beach',
postalCode: '90802',
@@ -515,6 +520,7 @@ describe('WarehousesView', () => {
expect(stateSelect?.props('modelValue')).toBe('OH')
expect(timezoneSelect?.props('modelValue')).toBe('UTC-5')
expect(countrySelect).toBeDefined()
expect((wrapper.find('input[placeholder="例如 154 或 CADF"]').element as HTMLInputElement).value).toBe('154')
const saveButton = [...document.querySelectorAll('button')].find((button) => button.textContent?.trim() === '保存修改')
expect(saveButton).toBeDefined()
@@ -525,6 +531,7 @@ describe('WarehousesView', () => {
const [, payload] = vi.mocked(updatePlatformWarehouse).mock.calls[0]
expect(payload).toMatchObject({
warehouseType: 'FBA',
internalCode: '154',
countryCode: 'US',
timezone: 'UTC-5',
address: expect.objectContaining({ stateProvince: 'OH' }),