feat: 增加店长审核模式与门店经营有效期
This commit is contained in:
@@ -5,6 +5,10 @@ const path = require('path')
|
||||
let definition
|
||||
let exitOptions
|
||||
let toastOptions
|
||||
let modalOptions
|
||||
let navigatedTo
|
||||
let modalChoice = { confirm: false, cancel: true }
|
||||
let modalCount = 0
|
||||
|
||||
global.Page = value => { definition = value }
|
||||
global.wx = {
|
||||
@@ -13,6 +17,14 @@ global.wx = {
|
||||
},
|
||||
showToast(options) {
|
||||
toastOptions = options
|
||||
},
|
||||
showModal(options) {
|
||||
modalOptions = options
|
||||
modalCount += 1
|
||||
if (options.success) options.success(modalChoice)
|
||||
},
|
||||
navigateTo(options) {
|
||||
navigatedTo = options.url
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,12 +66,32 @@ async function run() {
|
||||
exitOptions.fail()
|
||||
assert.strictEqual(toastOptions.title, '请同意协议后使用')
|
||||
|
||||
const statePage = createPage()
|
||||
statePage.handleResult({ status: 'PENDING_REVIEW', message: '申请审核中' })
|
||||
assert.strictEqual(modalOptions.title, '申请审核中')
|
||||
assert.strictEqual(modalOptions.showCancel, false)
|
||||
assert.strictEqual(statePage._presentedLoginState.startsWith('PENDING_REVIEW:'), true)
|
||||
|
||||
const modalCountBeforeError = modalCount
|
||||
const errorPage = createPage()
|
||||
errorPage.handleResult({ status: 'ERROR', message: '网络连接失败' })
|
||||
errorPage.handleResult({ status: 'ERROR', message: '网络连接失败' })
|
||||
assert.strictEqual(modalOptions.title, '登录失败')
|
||||
assert.strictEqual(modalCount, modalCountBeforeError + 1)
|
||||
|
||||
modalChoice = { confirm: true, cancel: false }
|
||||
const rejectedPage = createPage()
|
||||
rejectedPage.handleResult({ status: 'REJECTED', message: '资料需修改', registrationTicket: 'ticket-1', registrationApplicationId: 23 })
|
||||
assert.match(navigatedTo, /registrationTicket=ticket-1/)
|
||||
assert.match(navigatedTo, /applicationId=23/)
|
||||
|
||||
const template = fs.readFileSync(path.join(__dirname, 'index.wxml'), 'utf8')
|
||||
assert.match(template, /用户协议与隐私政策提示/)
|
||||
assert.match(template, /不同意并退出/)
|
||||
assert.match(template, /同意并继续/)
|
||||
assert.match(template, /data-type="USER_TERMS" catchtap="openAgreement"/)
|
||||
assert.match(template, /data-type="PRIVACY_POLICY" catchtap="openAgreement"/)
|
||||
assert.doesNotMatch(template, /class="state-line"/)
|
||||
}
|
||||
|
||||
run().catch(error => {
|
||||
|
||||
Reference in New Issue
Block a user