phase-10.5: test case fixes and updated postman collection
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user