优化
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { readInitialization, tableDefinitions, table, seedRows, roleAuthorities } from '../sql-baseline-contract-helpers.mjs'
|
||||
|
||||
const cn = readInitialization()
|
||||
@@ -17,7 +18,8 @@ test('种子解析覆盖多行多值、函数括号及带逗号和引号的文
|
||||
})
|
||||
|
||||
test('两个入口分别只操作八个主业务库与两个仓储业务库,包括限定名引用', () => {
|
||||
for (const [sql, allowed, other, count] of [[cn, domesticSchemas, overseasSchemas, 227], [overseas, overseasSchemas, domesticSchemas, 228]]) {
|
||||
// 国内补齐订单/仓库流水表;海外含自有业务四表与当前运输、流水基线。
|
||||
for (const [sql, allowed, other, count] of [[cn, domesticSchemas, overseasSchemas, 229], [overseas, overseasSchemas, domesticSchemas, 234]]) {
|
||||
assert.deepEqual([...sql.matchAll(/^CREATE DATABASE IF NOT EXISTS (\w+)/gm)].map(m => m[1]), allowed)
|
||||
assert.deepEqual([...new Set([...sql.matchAll(/^USE (\w+);/gm)].map(m => m[1]))], allowed)
|
||||
const body = sql.replace(/^--.*$/gm, '')
|
||||
@@ -173,7 +175,7 @@ test('平台管理员由外部bcrypt引导,强制首登改密且不创建客
|
||||
})
|
||||
|
||||
test('必要系统种子完整保留,但不写入示例资源与业务事实', () => {
|
||||
for (const [name, count] of Object.entries({ iam_role: 8, iam_permission: 433, iam_role_permission: 614,
|
||||
for (const [name, count] of Object.entries({ iam_role: 8, iam_permission: 440, iam_role_permission: 624,
|
||||
iam_data_scope: 7, wh_warehouse: 318, wh_warehouse_address: 318, wh_service_capability: 4,
|
||||
fl_fee_item: 112, fl_price_channel_catalog: 15, fl_price_origin_alias: 7, fl_price_warehouse_mapping: 4,
|
||||
file_export_task_guard: 1, fin_subject: 1 })) assert.equal(seedRows(cn, name).length, count, name)
|
||||
@@ -200,8 +202,15 @@ test('国内IAM权限与角色授权没有丢失或悬挂,客户模板仍完
|
||||
for (const row of permissions) if (row.parent_id && row.parent_id !== '0') assert.ok(permissionIds.has(row.parent_id), 'missing parent ' + row.parent_id)
|
||||
const merchant = roleAuthorities(cn, 'MERCHANT_OWNER')
|
||||
for (const code of ['merchant:enterprise', 'merchant:order:quick-create', 'merchant:finance:statement',
|
||||
'merchant:warehouse:delivery:list', 'merchant:warehouse:delivery:create']) assert.ok(merchant.has(code), code)
|
||||
'merchant:warehouse:delivery:list']) assert.ok(merchant.has(code), code)
|
||||
assert.ok(!merchant.has('merchant:warehouse:delivery:create'), '派送由排车履约生成,客户只读不能独立创建')
|
||||
const admin = roleAuthorities(cn, 'PLATFORM_ADMIN')
|
||||
for (const domain of ['owned-business', 'outsourced-business']) {
|
||||
for (const action of ['list', 'edit', 'upload']) {
|
||||
assert.ok(admin.has(`platform:fleet:${domain}:${action}`))
|
||||
assert.ok(!merchant.has(`platform:fleet:${domain}:${action}`))
|
||||
}
|
||||
}
|
||||
assert.ok(admin.has('platform:overseas-warehouse:discard:approve'), 'discard review endpoint must be grantable to platform administrator')
|
||||
for (const action of ['list', 'create', 'edit', 'status', 'review', 'upload']) {
|
||||
assert.ok(admin.has(`platform:overseas-master-data:driver:${action}`))
|
||||
|
||||
Reference in New Issue
Block a user