Fixup floating point equality using epsilon

This commit is contained in:
Ladd Hoffman 2023-03-13 15:16:13 -05:00
parent c72c681314
commit 440d934f19
1 changed files with 2 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { mochaRun } from '../../../util.js';
import { EPSILON, mochaRun } from '../../../util.js';
import { ForumTest } from './forum.test-util.js';
describe('Forum', function tests() {
@ -48,7 +48,7 @@ describe('Forum', function tests() {
{ postId: posts[2], weight: 0.05 },
]);
forum.getPost(posts[0]).value.should.equal(3.6);
forum.getPost(posts[1]).value.should.equal(0.40);
forum.getPost(posts[1]).value.should.be.within(0.40 - EPSILON, 0.40 + EPSILON);
forum.getPost(posts[2]).value.should.equal(1);
forum.getPost(posts[3]).value.should.equal(95);
});