23 lines
915 B
JavaScript
23 lines
915 B
JavaScript
import test from 'node:test'
|
|||
|
|
import assert from 'node:assert/strict'
|
||
|
|
import { readFileSync } from 'node:fs'
|
||
|
|
|
||
|
|
const sql = readFileSync(new URL('./db/security-projection-repair.sql', import.meta.url), 'utf8')
|
||
|
|
|
||
|
|
test('security projection repair derives every platform identity from IAM', () => {
|
||
|
|
assert.match(sql, /FROM baiyue_iam\.iam_user u/)
|
||
|
|
assert.match(sql, /CAST\(u\.auth_user_id AS CHAR\)/)
|
||
|
|
assert.doesNotMatch(sql, /9000000001|9000000003/)
|
||
|
|
})
|
||
|
|
|
||
|
|
test('security projection repair rebuilds user status and overseas authorization', () => {
|
||
|
|
assert.match(sql, /'USER'/)
|
||
|
|
assert.match(sql, /'AUTHORIZATION'/)
|
||
|
|
assert.match(sql, /platform:overseas-warehouse:/)
|
||
|
|
assert.match(sql, /platform:overseas-business:/)
|
||
|
|
assert.match(sql, /platform:overseas-master-data:/)
|
||
|
|
assert.match(sql, /platform:finance:/)
|
||
|
|
assert.match(sql, /lastleg:/)
|
||
|
|
assert.match(sql, /CONCAT\('repair-', u\.auth_user_id, '-[ua]-'/)
|
||
|
|
})
|