phase-10.5: test case fixes and updated postman collection

This commit is contained in:
saikiranvella
2026-06-12 00:47:41 -04:00
parent 65907a9b8d
commit 6cb4c93a0e
8 changed files with 524 additions and 668 deletions
+22
View File
@@ -84,6 +84,28 @@ test('BondScorer', async (t) => {
assert.ok(resultLong.audit?.passedGates);
});
await t.test('returns structured tier (P0.3)', () => {
const good: BondMetrics = {
ytm: 7.5, // 7.5% vs ~4% risk-free → wide spread
duration: 5,
creditRating: 'A',
creditRatingNumeric: 8,
};
const pass = BondScorer.score(good, DEFAULT_RULES);
assert.equal(pass.tier, 'PASS');
assert.equal(typeof pass.score, 'number');
const junk: BondMetrics = {
ytm: 8,
duration: 5,
creditRating: 'CCC',
creditRatingNumeric: 4, // below investment-grade gate
};
const reject = BondScorer.score(junk, DEFAULT_RULES);
assert.equal(reject.tier, 'REJECT');
assert.equal(reject.score, null);
});
await t.test('handles null/undefined metrics gracefully', () => {
const metrics = {
ytm: null,