重构项目文件夹目录
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
const assert = require('assert')
|
||||
|
||||
let relaunchedTo = ''
|
||||
let customerCleared = false
|
||||
let adminCleared = false
|
||||
|
||||
global.wx = {
|
||||
reLaunch(options) {
|
||||
relaunchedTo = options.url
|
||||
if (typeof options.success === 'function') {
|
||||
options.success()
|
||||
}
|
||||
},
|
||||
removeStorageSync() {},
|
||||
setStorageSync() {},
|
||||
getStorageSync() {
|
||||
return ''
|
||||
},
|
||||
removeTabBarBadge(options) {
|
||||
if (options && typeof options.fail === 'function') {
|
||||
options.fail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
global.getApp = () => ({
|
||||
clearUserSession() {
|
||||
customerCleared = true
|
||||
},
|
||||
clearAdminSession() {
|
||||
adminCleared = true
|
||||
}
|
||||
})
|
||||
|
||||
const sessionSwitch = require('./session-switch')
|
||||
|
||||
sessionSwitch.openAdminLogin()
|
||||
assert.strictEqual(customerCleared, true)
|
||||
assert.strictEqual(relaunchedTo, '/admin/pages/login/index')
|
||||
|
||||
sessionSwitch.openCustomerHome()
|
||||
assert.strictEqual(adminCleared, true)
|
||||
assert.strictEqual(relaunchedTo, '/pages/home/index')
|
||||
Reference in New Issue
Block a user