功能:增加店长员工审核与登录提醒
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
const assert = require('assert')
|
||||
|
||||
global.wx = {
|
||||
getAccountInfoSync: () => ({ miniProgram: { envVersion: 'develop' } }),
|
||||
getDeviceInfo: () => ({ platform: 'devtools' }),
|
||||
getStorageSync: () => '',
|
||||
setStorageSync: () => {},
|
||||
removeStorageSync: () => {}
|
||||
}
|
||||
|
||||
const appMock = {
|
||||
globalData: {
|
||||
userInfo: { type: 2 },
|
||||
openEmployeeReview: true
|
||||
}
|
||||
}
|
||||
global.getApp = () => appMock
|
||||
|
||||
let definition
|
||||
global.Page = value => { definition = value }
|
||||
require('./index')
|
||||
|
||||
function createPage() {
|
||||
return {
|
||||
...definition,
|
||||
data: { ...definition.data, isManager: true },
|
||||
setData(values) { Object.assign(this.data, values) }
|
||||
}
|
||||
}
|
||||
|
||||
async function run() {
|
||||
const employeesApi = require('../../api/employees')
|
||||
employeesApi.reviewApplications = async () => [{
|
||||
id: 12,
|
||||
applicationNo: 'SALON-001',
|
||||
applicantNickname: '小周',
|
||||
createTime: '2026-10-12T10:30:00'
|
||||
}]
|
||||
|
||||
const page = createPage()
|
||||
await page.onShow()
|
||||
|
||||
assert.strictEqual(appMock.globalData.openEmployeeReview, false)
|
||||
assert.strictEqual(page.data.reviewExpanded, true)
|
||||
assert.strictEqual(page.data.reviewPendingCount, 1)
|
||||
assert.strictEqual(page.data.reviewApplications[0].applicationTimeText, '2026-10-12 10:30')
|
||||
}
|
||||
|
||||
run().catch(error => {
|
||||
console.error(error)
|
||||
process.exitCode = 1
|
||||
})
|
||||
Reference in New Issue
Block a user