修复小程序后台路由误判
This commit is contained in:
@@ -16,19 +16,34 @@ global.wx = {
|
||||
global.getApp = () => ({ clearSession: () => {}, goLogin: () => {} })
|
||||
|
||||
const employeesApi = require('./api/employees')
|
||||
const authApi = require('./api/auth')
|
||||
const planningApi = require('./api/planning')
|
||||
const request = require('./utils/request')
|
||||
|
||||
async function run() {
|
||||
await planningApi.calendar({ startDate: '2026-10-27' })
|
||||
await authApi.login({ account: 'manager', password: 'secret' })
|
||||
await authApi.getLoginShops('manager')
|
||||
await authApi.switchShop(12)
|
||||
await authApi.logout()
|
||||
await employeesApi.reviewSummary()
|
||||
await employeesApi.reviewApplications()
|
||||
await employeesApi.approveApplication(12)
|
||||
await employeesApi.rejectApplication(12, '资料不完整')
|
||||
|
||||
assert.deepStrictEqual(requests.map(item => [item.method || 'GET', item.url, item.data]), [
|
||||
['GET', 'http://127.0.0.1:80/api/admin/user/workbench/registration/summary', undefined],
|
||||
['GET', 'http://127.0.0.1:80/api/admin/user/workbench/registration/list', undefined],
|
||||
['POST', 'http://127.0.0.1:80/api/admin/user/workbench/registration/12/approve', undefined],
|
||||
['POST', 'http://127.0.0.1:80/api/admin/user/workbench/registration/12/reject', { reason: '资料不完整' }]
|
||||
['GET', 'http://127.0.0.1:80/api/manager/planning/calendar?startDate=2026-10-27', undefined],
|
||||
['POST', 'http://127.0.0.1:80/api/user/login', { account: 'manager', password: 'secret' }],
|
||||
['GET', 'http://127.0.0.1:80/api/user/check/login-shops/account/manager', undefined],
|
||||
['POST', 'http://127.0.0.1:80/api/user/switch-shop', { shopId: 12 }],
|
||||
['POST', 'http://127.0.0.1:80/api/user/logout', undefined],
|
||||
['GET', 'http://127.0.0.1:80/api/user/workbench/registration/summary', undefined],
|
||||
['GET', 'http://127.0.0.1:80/api/user/workbench/registration/list', undefined],
|
||||
['POST', 'http://127.0.0.1:80/api/user/workbench/registration/12/approve', undefined],
|
||||
['POST', 'http://127.0.0.1:80/api/user/workbench/registration/12/reject', { reason: '资料不完整' }]
|
||||
])
|
||||
assert(requests.every(item => !item.url.includes('/api/admin/')))
|
||||
assert.strictEqual(request.toBackendRequestPath('http://127.0.0.1:80/api/manager/planning/calendar'), '/manager/planning/calendar')
|
||||
}
|
||||
|
||||
run().catch(error => {
|
||||
|
||||
Reference in New Issue
Block a user