Move forum tests to new subdir
This commit is contained in:
parent
e7ff4254a3
commit
c24952497d
|
@ -12,7 +12,7 @@
|
|||
<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/forum1.test.js"></script>
|
||||
<script type="module" src="./scripts/forum/forum1.test.js"></script>
|
||||
<script defer class="mocha-init">
|
||||
mocha.setup({
|
||||
ui: 'bdd',
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<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/forum2.test.js"></script>
|
||||
<script type="module" src="./scripts/forum/forum2.test.js"></script>
|
||||
<script defer class="mocha-init">
|
||||
mocha.setup({
|
||||
ui: 'bdd',
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<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/forum3.test.js"></script>
|
||||
<script type="module" src="./scripts/forum/forum3.test.js"></script>
|
||||
<script defer class="mocha-init">
|
||||
mocha.setup({
|
||||
ui: 'bdd',
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<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/forum4.test.js"></script>
|
||||
<script type="module" src="./scripts/forum/forum4.test.js"></script>
|
||||
<script defer class="mocha-init">
|
||||
mocha.setup({
|
||||
ui: 'bdd',
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { Box } from '../../classes/box.js';
|
||||
import { Scene } from '../../classes/scene.js';
|
||||
import { Expert } from '../../classes/expert.js';
|
||||
import { Bench } from '../../classes/bench.js';
|
||||
import { delay } from '../../util.js';
|
||||
import { Forum } from '../../classes/forum.js';
|
||||
import { PostContent } from '../../classes/post-content.js';
|
||||
import params from '../../params.js';
|
||||
import { Box } from '../../../classes/box.js';
|
||||
import { Scene } from '../../../classes/scene.js';
|
||||
import { Expert } from '../../../classes/expert.js';
|
||||
import { Bench } from '../../../classes/bench.js';
|
||||
import { delay } from '../../../util.js';
|
||||
import { Forum } from '../../../classes/forum.js';
|
||||
import { PostContent } from '../../../classes/post-content.js';
|
||||
import params from '../../../params.js';
|
||||
|
||||
export class ForumTest {
|
||||
constructor(options) {
|
||||
|
@ -26,7 +26,7 @@ export class ForumTest {
|
|||
const name = `Expert${index + 1}`;
|
||||
const expert = await new Expert(name, this.scene).initialize();
|
||||
this.experts.push(expert);
|
||||
// expert.addValue('rep', () => bench.reputation.valueOwnedBy(expert.reputationPublicKey))
|
||||
// expert.addValue('rep', () => this.bench.reputation.valueOwnedBy(expert.reputationPublicKey));
|
||||
return expert;
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
import { ForumTest } from './forum.test-util.js';
|
||||
|
||||
describe('Forum', () => {
|
||||
const forumTest = new ForumTest();
|
||||
|
||||
before(async () => {
|
||||
await forumTest.setup();
|
||||
});
|
||||
|
||||
context('Redistribute power', async () => {
|
||||
it('Post1', async () => {
|
||||
const { forum, experts, posts } = forumTest;
|
||||
await forumTest.addPost(experts[0], 20);
|
||||
forum.getPost(posts[0]).value.should.equal(20);
|
||||
});
|
||||
|
||||
it('Post2', async () => {
|
||||
const { forum, experts, posts } = forumTest;
|
||||
await forumTest.addPost(experts[0], 10);
|
||||
forum.getPost(posts[0]).value.should.equal(20);
|
||||
forum.getPost(posts[1]).value.should.equal(10);
|
||||
});
|
||||
|
||||
it('Post3 cites Post2 and negatively cites Post1', async () => {
|
||||
const { forum, experts, posts } = forumTest;
|
||||
await forumTest.addPost(experts[0], 10, [
|
||||
{ postId: posts[0], weight: -0.5 },
|
||||
{ postId: posts[1], weight: 0.5 },
|
||||
]);
|
||||
forum.getPost(posts[0]).value.should.equal(15);
|
||||
forum.getPost(posts[1]).value.should.equal(15);
|
||||
forum.getPost(posts[2]).value.should.equal(10);
|
||||
});
|
||||
|
||||
it('Post4 copies Post3 to increase its power', async () => {
|
||||
const { forum, experts, posts } = forumTest;
|
||||
await forumTest.addPost(experts[0], 10, [
|
||||
{ postId: posts[0], weight: -0.5 },
|
||||
{ postId: posts[1], weight: 0.5 },
|
||||
]);
|
||||
forum.getPost(posts[0]).value.should.equal(10);
|
||||
forum.getPost(posts[1]).value.should.equal(20);
|
||||
forum.getPost(posts[2]).value.should.equal(10);
|
||||
forum.getPost(posts[3]).value.should.equal(10);
|
||||
});
|
||||
it('Post5 cites Post3 and Post4 to increase their power', async () => {
|
||||
const { forum, experts, posts } = forumTest;
|
||||
await forumTest.addPost(experts[0], 20, [
|
||||
{ postId: posts[2], weight: 0.5 },
|
||||
{ postId: posts[3], weight: 0.5 },
|
||||
]);
|
||||
forum.getPost(posts[0]).value.should.equal(0);
|
||||
forum.getPost(posts[1]).value.should.equal(40);
|
||||
forum.getPost(posts[2]).value.should.equal(40);
|
||||
forum.getPost(posts[3]).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 }]);
|
Loading…
Reference in New Issue