import { mochaRun } from '../../../util/helpers.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('Redistribute power through subsequent support', async () => { let forum; let experts; let posts; before(() => { forum = forumTest.forum; experts = forumTest.experts; posts = forumTest.posts; }); it('Post1', async () => { await forumTest.addPost(experts[0], 10); forum.getPost(posts[0]).value.should.equal(10); }); it('Post2', async () => { await forumTest.addPost(experts[0], 10); forum.getPost(posts[0]).value.should.equal(10); forum.getPost(posts[1]).value.should.equal(10); }); it('Post3 cites Post2 and negatively cites Post1', async () => { await forumTest.addPost(experts[0], 0, [ { postId: posts[0], weight: -1 }, { postId: posts[1], weight: 1 }, ]); forum.getPost(posts[0]).value.should.equal(10); forum.getPost(posts[1]).value.should.equal(10); forum.getPost(posts[2]).value.should.equal(0); }); it('Post4 cites Post3 to strengthen its effect', async () => { await forumTest.addPost(experts[0], 10, [ { postId: posts[2], weight: 1 }, ]); forum.getPost(posts[0]).value.should.equal(0); forum.getPost(posts[1]).value.should.equal(30); forum.getPost(posts[2]).value.should.equal(0); forum.getPost(posts[3]).value.should.equal(0); }); it('Post5 cites Post3 to strengthen its effect', async () => { await forumTest.addPost(experts[0], 10, [ { postId: posts[2], weight: 1 }, ]); forum.getPost(posts[0]).value.should.equal(0); forum.getPost(posts[1]).value.should.equal(40); forum.getPost(posts[2]).value.should.equal(0); forum.getPost(posts[3]).value.should.equal(0); forum.getPost(posts[4]).value.should.equal(0); }); }); }); // await addPost(experts[0], 10); // await addPost(experts[0], 10, [{ postId: posts[3], weight: -1 }]); // await addPost(experts[0], 10, [{ postId: posts[4], weight: -1 }]); // await addPost(expert3, 'Post 4', 100, [{ postId: postId2, weight: -1 }]); // await addPost(expert1, 'Post 5', 100, [{ postId: postId3, weight: -1 }]); mochaRun();