diff --git a/forum-network/src/classes/expert.js b/forum-network/src/classes/expert.js
index 04f80a9..b386374 100644
--- a/forum-network/src/classes/expert.js
+++ b/forum-network/src/classes/expert.js
@@ -39,12 +39,12 @@ export class Expert extends ReputationHolder {
async submitPost(postContent) {
// TODO: Include fee
- await this.actions.submitPost.log(this, this.dao.forum);
+ await this.actions.submitPost.log(this, this.dao);
return this.dao.forum.addPost(this.reputationPublicKey, postContent);
}
async submitPostWithFee(postContent, poolOptions) {
- await this.actions.submitPost.log(this, this.dao.forum);
+ await this.actions.submitPost.log(this, this.dao);
const postId = await this.dao.forum.addPost(this.reputationPublicKey, postContent);
const pool = await this.initiateValidationPool({ ...poolOptions, postId });
this.tokens.push(pool.tokenId);
diff --git a/forum-network/src/index.html b/forum-network/src/index.html
index e4bd968..d40757e 100644
--- a/forum-network/src/index.html
+++ b/forum-network/src/index.html
@@ -16,6 +16,7 @@
Negative citation of a weaker negative citation
Redistribute power
Redistribute power through subsequent support
+ Destroy a post after it has received positive citations
diff --git a/forum-network/src/tests/forum5.test.html b/forum-network/src/tests/forum5.test.html
new file mode 100644
index 0000000..5d25dc8
--- /dev/null
+++ b/forum-network/src/tests/forum5.test.html
@@ -0,0 +1,27 @@
+
+
+ Forum test 5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/forum-network/src/tests/scripts/forum/forum5.test.js b/forum-network/src/tests/scripts/forum/forum5.test.js
new file mode 100644
index 0000000..2274d57
--- /dev/null
+++ b/forum-network/src/tests/scripts/forum/forum5.test.js
@@ -0,0 +1,59 @@
+import { ForumTest } from './forum.test-util.js';
+
+describe('Forum', () => {
+ const forumTest = new ForumTest();
+
+ before(async () => {
+ await forumTest.setup();
+ });
+
+ context('Destroy a post after it has received positive citations', 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], 100);
+ forum.getPost(posts[0]).value.should.equal(100);
+ });
+
+ it('Post2 negatively cites Post1', async () => {
+ await forumTest.addPost(experts[0], 10, [
+ { postId: posts[0], weight: -0.5 },
+ ]);
+ forum.getPost(posts[0]).value.should.equal(95);
+ forum.getPost(posts[1]).value.should.equal(15);
+ });
+
+ it('Post3 positively cites Post2', async () => {
+ await forumTest.addPost(experts[0], 50, [
+ { postId: posts[1], weight: 0.5 },
+ ]);
+ forum.getPost(posts[0]).value.should.equal(95 - 12.5);
+ forum.getPost(posts[1]).value.should.equal(15 + 25 + 12.5);
+ forum.getPost(posts[2]).value.should.equal(25);
+ });
+
+ it('Post4 negatively cites Post2', async () => {
+ await forumTest.addPost(experts[0], 100, [
+ { postId: posts[1], weight: -1 },
+ ]);
+ // forum.getPost(posts[0]).value.should.equal(95 - 12.5);
+ // forum.getPost(posts[1]).value.should.equal(15 + 25 + 12.5);
+ // forum.getPost(posts[2]).value.should.equal(25);
+ });
+ });
+});
+
+// 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 }]);