Intelligence, Advanced Charting & Trading Platform
test: use tolerance for floating-point premium
davoodmehraban89 committed
Oct 5, 2026 at 16:17 UTC
f6ff3aa13263dbaa79f77e9202e21640ab857a7e
1 file changed
+2
-1
packages/market-domain/test/gold-pricing.test.mjs
+2
-1
@@ -10,7 +10,8 @@ test('calculates theoretical 18K gold in IRT per gram', () => {
10
11
test('calculates absolute and percentage premium', () => {
12
const result = goldPremium({ marketIrtPerGram: 10_500_000, theoreticalIrtPerGram: 10_000_000 });
13
- assert.deepEqual(result, { absoluteIrt: 500_000, percent: 5 });
13
+ assert.equal(result.absoluteIrt, 500_000);
14
+ assert.ok(Math.abs(result.percent - 5) < 1e-12);
15
});
16
17
test('rejects zero or negative market inputs', () => {