mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-23 03:18:09 +08:00
feat(ql3): establish 3.0 incubation baseline
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
const assert = require('node:assert/strict');
|
||||
const { test } = require('node:test');
|
||||
|
||||
const {
|
||||
ClusterApprovalDecisionManagementConfigurationError,
|
||||
createClusterApprovalDecisionManagementService,
|
||||
} = require('@qinglong/cluster-admin/approval-decision-management');
|
||||
|
||||
test('composes the shared Approval decision authority over a caller-owned pool', () => {
|
||||
const pool = {
|
||||
async query() {
|
||||
throw new Error('not used');
|
||||
},
|
||||
async connect() {
|
||||
throw new Error('not used');
|
||||
},
|
||||
};
|
||||
const service = createClusterApprovalDecisionManagementService({ pool });
|
||||
assert.equal(typeof service.decide, 'function');
|
||||
assert.equal(Object.isFrozen(service), true);
|
||||
});
|
||||
|
||||
test('rejects missing pool authority and widened options', () => {
|
||||
for (const options of [
|
||||
{},
|
||||
{ pool: { query() {} } },
|
||||
{ pool: { query() {}, connect() {} }, transport: {} },
|
||||
]) {
|
||||
assert.throws(
|
||||
() => createClusterApprovalDecisionManagementService(options),
|
||||
ClusterApprovalDecisionManagementConfigurationError,
|
||||
);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user