完善店员申请关联与预约页面
This commit is contained in:
@@ -3,10 +3,12 @@ const employeesApi = require('../../api/employees')
|
||||
|
||||
let navigatedBack = false
|
||||
let navigatedTo = ''
|
||||
let modalConfirm = false
|
||||
global.wx = {
|
||||
getAccountInfoSync: () => ({ miniProgram: { envVersion: 'develop' } }),
|
||||
getDeviceInfo: () => ({ platform: 'devtools' }),
|
||||
showToast: () => {},
|
||||
showModal: options => options.success({ confirm: modalConfirm }),
|
||||
navigateBack: () => { navigatedBack = true },
|
||||
navigateTo: options => { navigatedTo = options.url }
|
||||
}
|
||||
@@ -102,6 +104,35 @@ async function run() {
|
||||
page.data.appointmentContext = { date: '2026-10-12', time: '14:00', durationMinutes: '60' }
|
||||
page.setupFirstSchedule()
|
||||
assert.strictEqual(navigatedTo.includes('/pages/schedule-setting/index?id=88&onboarding=1&source=appointment'), true)
|
||||
|
||||
let employeeCreateCount = 0
|
||||
let approvalAttempts = 0
|
||||
let approvalPayload
|
||||
page.data.form = { nickname: '申请档案员工', phone: '13800138001', wechatId: '', color: '#8FB89A', avatar: '', avatarUrl: '' }
|
||||
page.data.createdEmployee = null
|
||||
page.data.applicationId = '42'
|
||||
page.data.applicationApproved = false
|
||||
page.data.onboardingVisible = false
|
||||
employeesApi.createUser = async () => { employeeCreateCount += 1; return { userId: 90 } }
|
||||
employeesApi.approveApplication = async (applicationId, payload) => {
|
||||
approvalAttempts += 1
|
||||
approvalPayload = { applicationId, ...payload }
|
||||
if (approvalAttempts === 1) throw new Error('暂时无法审核')
|
||||
}
|
||||
await page.submit()
|
||||
assert.strictEqual(employeeCreateCount, 1)
|
||||
assert.deepStrictEqual(approvalPayload, {
|
||||
applicationId: '42',
|
||||
targetArtistUserId: 90,
|
||||
useApplicantNickname: false,
|
||||
useApplicantAvatar: false
|
||||
})
|
||||
assert.strictEqual(page.data.createdEmployee.id, 90)
|
||||
assert.strictEqual(page.data.onboardingVisible, true)
|
||||
await page.associateCreatedEmployee()
|
||||
assert.strictEqual(employeeCreateCount, 1)
|
||||
assert.strictEqual(approvalAttempts, 2)
|
||||
assert.strictEqual(page.data.applicationApproved, true)
|
||||
}
|
||||
|
||||
run().catch(error => {
|
||||
|
||||
Reference in New Issue
Block a user