Added test of a currently failing scenario

This commit is contained in:
Ladd Hoffman 2023-01-29 12:41:03 -06:00
parent e26afa1eb4
commit 23070ae381
1 changed files with 35 additions and 6 deletions

View File

@ -86,16 +86,45 @@ async function setup() {
// } // }
} }
describe('Negative citation of a negative citation', async () => { describe('Forum', () => {
before(async () => { before(async () => {
await setup(); await setup();
await addPost(experts[0], 10);
await addPost(experts[0], 10, [{ postId: posts[0], weight: -1 }]);
await addPost(experts[0], 10, [{ postId: posts[1], weight: -1 }]);
}); });
it('Should restore original post to its initial value', () => { context('Negative citation of a negative citation with max strength', async () => {
it('Post1', async () => {
await addPost(experts[0], 10);
forum.getPost(posts[0]).value.should.equal(10); forum.getPost(posts[0]).value.should.equal(10);
}); });
it('Post2 negatively cites Post1', async () => {
await addPost(experts[0], 10, [{ postId: posts[0], weight: -1 }]);
forum.getPost(posts[0]).value.should.equal(0);
forum.getPost(posts[1]).value.should.equal(20);
});
it('Post3 negatively cites Post2, restoring Post1 post to its initial value', async () => {
await addPost(experts[0], 10, [{ postId: posts[1], weight: -1 }]);
forum.getPost(posts[0]).value.should.equal(10);
forum.getPost(posts[1]).value.should.equal(0);
forum.getPost(posts[2]).value.should.equal(20);
});
});
context('Negative citation of a weaker negative citation', async () => {
it('Post4', async () => {
await addPost(experts[0], 10);
forum.getPost(posts[3]).value.should.equal(10);
});
it('Post5 negatively cites Post4', async () => {
await addPost(experts[0], 10, [{ postId: posts[3], weight: -0.5 }]);
forum.getPost(posts[3]).value.should.equal(5);
forum.getPost(posts[4]).value.should.equal(15);
});
it('Post6 negatively cites Post5, restoring Post4 post to its initial value', async () => {
await addPost(experts[0], 20, [{ postId: posts[4], weight: -1 }]);
forum.getPost(posts[3]).value.should.equal(10);
forum.getPost(posts[4]).value.should.equal(0);
forum.getPost(posts[5]).value.should.equal(30);
});
});
}); });
// await addPost(experts[0], 10); // await addPost(experts[0], 10);