Files
ftb-project-management/apps/web/lib/ai-estimation-policy.test.ts
2026-06-25 14:50:43 +08:00

26 lines
950 B
TypeScript

import test from 'node:test';
import assert from 'node:assert/strict';
import {
clampDevEstimateHours,
clampTestCaseEstimateHours,
getDefaultTestCaseEstimateHours,
} from './ai-estimation-policy';
test('clamps simple frontend interaction to AI-assisted range', () => {
assert.equal(clampDevEstimateHours('frontend_interaction', 5), 1);
assert.equal(clampDevEstimateHours('frontend_interaction', 0.1), 0.5);
});
test('keeps backend API within strict range', () => {
assert.equal(clampDevEstimateHours('backend_api', 0.25), 0.75);
assert.equal(clampDevEstimateHours('backend_api', 2), 1.5);
});
test('defaults and clamps test case estimates', () => {
assert.equal(getDefaultTestCaseEstimateHours('test_functional'), 0.5);
assert.equal(clampTestCaseEstimateHours('test_functional', 2), 0.5);
assert.equal(clampTestCaseEstimateHours('test_api', 0.25), 0.5);
assert.equal(clampTestCaseEstimateHours('test_exception', 2), 1);
});