This commit is contained in:
2026-09-19 17:02:11 +08:00
parent 4eb17ece4f
commit 514abf6eda
33 changed files with 525 additions and 223 deletions
@@ -6,14 +6,23 @@ const source = readFileSync(new URL('./QuickOrderView.vue', import.meta.url), 'u
const routesSource = readFileSync(new URL('../routes.ts', import.meta.url), 'utf8')
const contractsSource = readFileSync(new URL('../../tenant-management/contracts.ts', import.meta.url), 'utf8')
const orderViewSource = readFileSync(new URL('./FirstLegOrdersView.vue', import.meta.url), 'utf8')
const createHubSource = readFileSync(new URL('./FirstLegOrderCreateHubView.vue', import.meta.url), 'utf8')
test('exposes quick order as an active first-leg route with its dedicated permission', () => {
test('keeps quick order active but moves it from the menu into the head-leg create page', () => {
assert.match(routesSource, /path: 'first-leg\/quick-order'[\s\S]*?release: 'active'[\s\S]*?permission: 'order:first-leg:quick-create'/)
assert.match(contractsSource, /code: 'order:first-leg:quick-create'[\s\S]*?label: '快速下单'/)
assert.match(contractsSource, /'order:first-leg:quick-create': \['merchant:order:quick-create', 'merchant:order:create'\]/)
assert.match(contractsSource, /FRONTEND_PERMISSIONS_REQUIRING_ALL_BACKEND_CODES[\s\S]*?'order:first-leg:quick-create'/)
assert.match(routesSource, /path: 'orders\/first-leg\/:draftId\/edit'[\s\S]*?name: 'first-leg-order-edit'[\s\S]*?permission: 'order:first-leg:edit'/)
assert.match(orderViewSource, /store\.loadDraftDetail\(id\)/)
assert.doesNotMatch(routesSource, /navigation: \{ key: 'first-leg-quick-order'/)
assert.match(routesSource, /path: 'orders\/first-leg\/create'[\s\S]*?FirstLegOrderCreateHubView\.vue/)
assert.match(createHubSource, />普通下单<\/button>/)
assert.match(createHubSource, />快速下单<\/button>/)
assert.match(createHubSource, /<h1>头程下单<\/h1>/)
assert.match(createHubSource, /auth\.hasPermission\('order:first-leg:quick-create'\)/)
assert.match(createHubSource, /<FirstLegOrdersView v-if="activeMode === 'standard'" create-page \/>/)
assert.match(createHubSource, /<QuickOrderView v-else \/>/)
})
test('keeps the primary quick-order table focused on inbound code policy, channel, destination and cargo', () => {