Merge branch 'dev' into 'main'
Add example of work SC prototype reputation graph See merge request dao-governance-framework/science-publishing-dao!3
This commit is contained in:
commit
dddee70365
|
@ -20,6 +20,7 @@
|
||||||
<li><a href="./tests/forum3.test.html">Redistribute power</a></li>
|
<li><a href="./tests/forum3.test.html">Redistribute power</a></li>
|
||||||
<li><a href="./tests/forum4.test.html">Redistribute power through subsequent support</a></li>
|
<li><a href="./tests/forum4.test.html">Redistribute power through subsequent support</a></li>
|
||||||
<li><a href="./tests/forum5.test.html">Destroy a post after it has received positive citations</a></li>
|
<li><a href="./tests/forum5.test.html">Destroy a post after it has received positive citations</a></li>
|
||||||
|
<li><a href="./tests/forum6.test.html">Initially zero-valued posts later receive citations</a></li>
|
||||||
</ol>
|
</ol>
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
<script type="module" src="./scripts/forum/forum3.test.js"></script>
|
<script type="module" src="./scripts/forum/forum3.test.js"></script>
|
||||||
<script type="module" src="./scripts/forum/forum4.test.js"></script>
|
<script type="module" src="./scripts/forum/forum4.test.js"></script>
|
||||||
<script type="module" src="./scripts/forum/forum5.test.js"></script>
|
<script type="module" src="./scripts/forum/forum5.test.js"></script>
|
||||||
|
<script type="module" src="./scripts/forum/forum6.test.js"></script>
|
||||||
<script defer class="mocha-init">
|
<script defer class="mocha-init">
|
||||||
mocha.setup({
|
mocha.setup({
|
||||||
ui: 'bdd',
|
ui: 'bdd',
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>Forum test 6</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/mocha/mocha.css" />
|
||||||
|
<link type="text/css" rel="stylesheet" href="../index.css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h2><a href="../">DGF Tests</a></h2>
|
||||||
|
<div id="mocha"></div>
|
||||||
|
<div id="scene"></div>
|
||||||
|
</body>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/radash/10.7.0/radash.js"
|
||||||
|
integrity="sha512-S207zKWG3iqXqe6msO7/Mr8X3DzzF4u8meFlokHjGtBPTGUhgzVo0lpcqEy0GoiMUdcoct+H+SqzoLsxXbynzg=="
|
||||||
|
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
|
<script src="https://unpkg.com/mocha/mocha.js"></script>
|
||||||
|
<script src="https://unpkg.com/chai/chai.js"></script>
|
||||||
|
<script type="module" src="./scripts/forum/forum6.test.js"></script>
|
||||||
|
<script defer class="mocha-init">
|
||||||
|
mocha.setup({
|
||||||
|
ui: 'bdd',
|
||||||
|
});
|
||||||
|
chai.should();
|
||||||
|
</script>
|
|
@ -0,0 +1,76 @@
|
||||||
|
import { EPSILON, mochaRun } from '../../../util.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('Initially zero-valued post later receives citations', 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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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();
|
Loading…
Reference in New Issue