From d047b2a9ef33ca914fb1fe4a3c138e1f6cdaa4d8 Mon Sep 17 00:00:00 2001 From: Dmitriy Yurov Date: Sat, 19 Oct 2024 13:01:22 +0200 Subject: [PATCH] fix test --- tests/ama/ama.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ama/ama.spec.ts b/tests/ama/ama.spec.ts index b63568e..7325c99 100644 --- a/tests/ama/ama.spec.ts +++ b/tests/ama/ama.spec.ts @@ -3,14 +3,14 @@ import { data } from './data'; describe('Adaptive Moving Average', () => { const ama = new AMA(15, 2, 30); - const EPSILON = 0.01; + const EPSILON = 0.001; it('Excel validate', () => { data.forEach((tick, idx) => { const amaValue = ama.nextValue(tick.c); const expected = Number(tick.ama); - if (amaValue) { + if (amaValue && expected) { expect(Math.abs(amaValue - expected)).toBeLessThan(EPSILON); }