Add test verifying reputation cannot be sourced from incinerator
This commit is contained in:
parent
353190fdcd
commit
2ed07b7f5e
|
@ -184,6 +184,7 @@ export class Forum extends ReputationHolder {
|
|||
if (citationEdge.to.id === INCINERATOR_ADDRESS) {
|
||||
// Only a positive amount may be incinerated! Otherwise the sink could be used as a source.
|
||||
if (outboundAmount < 0) {
|
||||
this.scene?.flowchart?.log(`style ${citationEdge.from.id} fill:#620000`);
|
||||
throw new Error('Incinerator can only receive positive citations!');
|
||||
}
|
||||
// Reputation sent to the incinerator is burned! This means it is deducted from the sender,
|
||||
|
|
|
@ -34,6 +34,16 @@ describe('Forum', function tests() {
|
|||
forum.getPost(posts[0]).value.should.equal(0);
|
||||
forum.getPost(posts[1]).value.should.equal(0);
|
||||
});
|
||||
|
||||
it('Reputation can not be sourced from the incinerator', async () => {
|
||||
try {
|
||||
await forumTest.addPost(experts[0], 10, [
|
||||
{ postId: INCINERATOR_ADDRESS, weight: -1 },
|
||||
]);
|
||||
} catch (e) {
|
||||
e.message.should.match(/Incinerator can only receive positive citations/);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue