23 lines
1.1 KiB
JavaScript
23 lines
1.1 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import { readFileSync } from 'node:fs'
|
|
import test from 'node:test'
|
|
import { readInitialization, table } from './sql-baseline-contract-helpers.mjs'
|
|
|
|
const firstleg = readFileSync(new URL('../firstleg/src/main/resources/db/phase2-inbound-schema.sql', import.meta.url), 'utf8')
|
|
const fee = table(readInitialization(), 'baiyue_firstleg', 'fl_inbound_fee')
|
|
|
|
test('统一初始化与模块入库费用均直接定义计费基准和容差', () => {
|
|
for (const source of [fee, firstleg]) {
|
|
assert.match(source, /baseline_chargeable_quantity DECIMAL\(18,6\) NOT NULL/i)
|
|
assert.match(source, /tolerance_percent DECIMAL\(5,2\) NOT NULL DEFAULT '?10\.00'?/i)
|
|
}
|
|
assert.doesNotMatch(readInitialization(), /SET baseline_chargeable_quantity = chargeable_quantity|MODIFY COLUMN baseline_chargeable_quantity/)
|
|
})
|
|
|
|
test('最终建表保留入库费用唯一身份和基准非空约束', () => {
|
|
assert.match(fee, /PRIMARY KEY \(id\)/)
|
|
assert.match(fee, /UNIQUE KEY/)
|
|
assert.match(fee, /baseline_chargeable_quantity decimal\(18,6\) NOT NULL/i)
|
|
assert.match(fee, /tolerance_percent decimal\(5,2\) NOT NULL/i)
|
|
})
|