This commit is contained in:
2026-08-12 18:50:03 +08:00
parent 41a131a33b
commit 2c5f53ec00
29 changed files with 513 additions and 283 deletions
@@ -1,7 +1,12 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { getCustomerOverseasStorageFees, updateCustomerOverseasStorageFees } from './overseasStorageFee'
import { http } from '@/shared/api/http'
const overseasListSource = readFileSync(resolve(process.cwd(), 'src/modules/customers/pages/OverseasStorageFeesView.vue'), 'utf8')
const overseasPanelSource = readFileSync(resolve(process.cwd(), 'src/modules/customers/CustomerOverseasStorageFeePanel.vue'), 'utf8')
vi.mock('@/shared/api/http', () => ({
http: { get: vi.fn(), put: vi.fn() },
unwrapApiResponse: <T>(response: { data: T }) => response.data,
@@ -12,6 +17,17 @@ const config = { id: 12, customerId: 9007199254740993n.toString(), customerName:
describe('customer overseas storage fee api', () => {
beforeEach(() => vi.clearAllMocks())
it('keeps overseas fee business actions as semantic buttons at narrow widths', () => {
expect(overseasListSource).toContain('border stripe')
expect(overseasListSource).toContain('size="small" plain type="primary"')
expect(overseasListSource).toContain('size="small" plain type="danger"')
expect(overseasListSource).toContain('<Pencil :size="15" />')
expect(overseasListSource).toContain('<Trash2 :size="15" />')
expect(overseasListSource).toContain('@media (max-width:720px)')
expect(overseasPanelSource).toContain('size="small" plain type="danger"')
expect(overseasPanelSource).toContain('@media (max-width:760px)')
})
it('keeps customer ids as strings and uses the customer detail path', async () => {
vi.mocked(http.get).mockResolvedValue({ data: config })
const result = await getCustomerOverseasStorageFees(config.customerId)