优化
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
} from '@/modules/fba-pricing'
|
||||
import { useAccessPreviewStore } from '@/core/access/accessPreview'
|
||||
import { useAuthStore } from '@/core/auth/auth'
|
||||
import AppDialog from '@/shared/components/AppDialog.vue'
|
||||
import CustomerBillingRulesPanel from './CustomerBillingRulesPanel.vue'
|
||||
|
||||
vi.mock('@/modules/dimension-config', () => ({ getCustomerDimensionConfig: vi.fn(), updateCustomerDimensionConfig: vi.fn(), updateCustomerDimensionDefaultCalculationMode: vi.fn() }))
|
||||
@@ -93,7 +94,7 @@ describe('CustomerBillingRulesPanel', () => {
|
||||
})
|
||||
|
||||
it('submits all four rows in one update request', async () => {
|
||||
mount(CustomerBillingRulesPanel, { attachTo: document.body, props: { customerId: '8', customerName: '柏悦物流' }, global: { plugins: [ElementPlus] } })
|
||||
const wrapper = mount(CustomerBillingRulesPanel, { attachTo: document.body, props: { customerId: '8', customerName: '柏悦物流' }, global: { plugins: [ElementPlus] } })
|
||||
await flushPromises()
|
||||
;[...document.querySelectorAll<HTMLButtonElement>('button')].find((button) => button.textContent?.trim() === '编辑规则')?.click()
|
||||
await flushPromises()
|
||||
@@ -105,6 +106,7 @@ describe('CustomerBillingRulesPanel', () => {
|
||||
expect(Object.keys(submittedRules[0]).sort()).toEqual([
|
||||
'boxType', 'edgeAdditionCm', 'innerHeightCm', 'innerLengthCm', 'innerWidthCm', 'remark', 'version',
|
||||
])
|
||||
expect(wrapper.findComponent(AppDialog).props('modelValue')).toBe(false)
|
||||
})
|
||||
|
||||
it('keeps the editor open when the whole-set save fails', async () => {
|
||||
@@ -125,7 +127,7 @@ describe('CustomerBillingRulesPanel', () => {
|
||||
...config,
|
||||
defaultCalculationMode: 'MULTIPLY',
|
||||
})
|
||||
mount(CustomerBillingRulesPanel, { attachTo: document.body, props: { customerId: '8', customerName: '柏悦物流' }, global: { plugins: [ElementPlus] } })
|
||||
const wrapper = mount(CustomerBillingRulesPanel, { attachTo: document.body, props: { customerId: '8', customerName: '柏悦物流' }, global: { plugins: [ElementPlus] } })
|
||||
await flushPromises()
|
||||
|
||||
;[...document.querySelectorAll<HTMLButtonElement>('button')].find((button) => button.textContent?.trim() === '编辑规则')?.click()
|
||||
@@ -139,6 +141,7 @@ describe('CustomerBillingRulesPanel', () => {
|
||||
remark: expect.stringMatching(/SMALL:30,20,20;系数:\d+(?:\.\d+)?/),
|
||||
}))
|
||||
expect(setCustomerChargeRuleDefault).toHaveBeenCalledWith('8', '201')
|
||||
expect(wrapper.findComponent(AppDialog).props('modelValue')).toBe(false)
|
||||
|
||||
const defaultRuleCheckboxes = [...document.querySelectorAll<HTMLInputElement>('input[type="checkbox"]')]
|
||||
defaultRuleCheckboxes[1]?.click()
|
||||
|
||||
Reference in New Issue
Block a user