feat(category): 类目树、类目属性、属性字典维护系统构建完成
This commit is contained in:
@@ -2,7 +2,9 @@ import assert from 'node:assert/strict';
|
||||
import type { Database } from '@atlas/database';
|
||||
import { describe, it } from 'vitest';
|
||||
import {
|
||||
attributeBatchInputSchema,
|
||||
parseInput,
|
||||
refreshPolicyInputSchema,
|
||||
sourceInputSchema,
|
||||
syncInputSchema,
|
||||
} from '../src/platform-catalog-admin/platform-catalog-admin.models.js';
|
||||
@@ -46,4 +48,41 @@ describe('平台目录系统管理员边界', () => {
|
||||
workspace_id: 'forbidden',
|
||||
}));
|
||||
});
|
||||
|
||||
it('刷新策略要求过期天数严格大于新鲜天数', () => {
|
||||
assert.deepEqual(parseInput(refreshPolicyInputSchema, {
|
||||
attribute_fresh_days: 14,
|
||||
attribute_expire_days: 21,
|
||||
dictionary_fresh_days: 14,
|
||||
dictionary_expire_days: 21,
|
||||
}), {
|
||||
attribute_fresh_days: 14,
|
||||
attribute_expire_days: 21,
|
||||
dictionary_fresh_days: 14,
|
||||
dictionary_expire_days: 21,
|
||||
});
|
||||
assert.throws(() => parseInput(refreshPolicyInputSchema, {
|
||||
attribute_fresh_days: 21,
|
||||
attribute_expire_days: 21,
|
||||
dictionary_fresh_days: 14,
|
||||
dictionary_expire_days: 21,
|
||||
}));
|
||||
assert.throws(() => parseInput(refreshPolicyInputSchema, {
|
||||
attribute_fresh_days: 14,
|
||||
attribute_expire_days: 21,
|
||||
dictionary_fresh_days: 0,
|
||||
dictionary_expire_days: 21,
|
||||
}));
|
||||
});
|
||||
|
||||
it('属性同步批次只接受三种冻结范围', () => {
|
||||
for (const mode of ['missing_expired', 'missing_stale_expired', 'all'] as const) {
|
||||
assert.deepEqual(parseInput(attributeBatchInputSchema, { mode }), { mode });
|
||||
}
|
||||
assert.throws(() => parseInput(attributeBatchInputSchema, { mode: 'stale_only' }));
|
||||
assert.throws(() => parseInput(attributeBatchInputSchema, {
|
||||
mode: 'all',
|
||||
category_id: '3f7e8462-c23c-4a38-ae86-0f3d78503870',
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user