import { mochaRun } from '../../../util/helpers.js'; import { EPSILON } from '../../../util/constants.js'; import { ForumTest } from '../forum.test-util.js'; describe('Forum', function tests() { this.timeout(0); const forumTest = new ForumTest(); before(async () => { await forumTest.setup(); }); context('Negatively citing a zero-valued post', async () => { let forum; let experts; let posts; before(() => { forum = forumTest.forum; experts = forumTest.experts; posts = forumTest.posts; }); it('Post1: Work SC prototype', async () => { await forumTest.addPost(experts[0], 0); forum.getPost(posts[0]).value.should.equal(0); }); it('Post2: Work SC improvement', async () => { await forumTest.addPost(experts[0], 0, [ { postId: posts[0], weight: 0.9 }, ]); forum.getPost(posts[0]).value.should.equal(0); forum.getPost(posts[1]).value.should.equal(0); }); it('Post3: Work SC improvement', async () => { await forumTest.addPost(experts[0], 0, [ { postId: posts[1], weight: 0.8 }, ]); forum.getPost(posts[0]).value.should.equal(0); forum.getPost(posts[1]).value.should.equal(0); forum.getPost(posts[2]).value.should.equal(0); }); it('Post4: Work evidence using latest work SC', async () => { await forumTest.addPost(experts[0], 100, [ { postId: posts[2], weight: 0.05 }, ]); forum.getPost(posts[0]).value.should.equal(3.6); 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); }); it('Post5: Work evidence using latest work SC', async () => { await forumTest.addPost(experts[0], 100, [ { postId: posts[2], weight: 0.05 }, ]); forum.getPost(posts[0]).value.should.equal(7.2); forum.getPost(posts[1]).value.should.be.within(0.80 - EPSILON, 0.80 + EPSILON); forum.getPost(posts[2]).value.should.equal(2); forum.getPost(posts[3]).value.should.equal(95); forum.getPost(posts[4]).value.should.equal(95); }); }); }); mochaRun();