git ssb

0+

dangerousbeans / Entropy_contracts



Tree: 0288fd21356a15c8f3f95a9f431bc370405ac46c

Files: 0288fd21356a15c8f3f95a9f431bc370405ac46c / test / Entropy_actions.js

1582 bytesRaw
1const helpers = require('./helpers');
2
3contract('Entropy - Actions', (accounts) => {
4 /**
5 * Actions
6 *
7 */
8
9 describe("Creating actions", () =>{
10 it("stops untrusted Citizens from creating actions", (done) => {
11 helpers.deployEntropyContract()
12 .then((entropy) => {
13 return helpers.expectedExceptionPromise(() => {
14 return entropy.newAction(1e18, "Rigging refit", { from: accounts[1]});
15 }, 3000000)
16 .then(()=>{
17 entropy.actions_count().then((actions_count) => {
18 assert.equal(actions_count, 0);
19 done();
20 })
21 })
22 })
23 });
24
25 it("lets trusted Citizens create actions", (done) => {
26 helpers.deployEntropyContract()
27 .then((entropy) => {
28 entropy.newAction(1e18, "Rigging refit").then((tx) => {
29 entropy.actions_count().then((actions_count) => {
30 assert.equal(actions_count, 1);
31 })
32 .then(()=>{ done() })
33 })
34 })
35 })
36 })
37
38 describe("Voting", () =>{
39 it("lets trusted citizens vote", (done) => {
40 helpers.deployEntropyContract()
41 .then((entropy) => {
42 entropy.newAction(1e18, "Rigging refit")
43 .then((tx) => {
44 // Vote in favour!
45 entropy.vote(0, true).then((tx) => {
46 done();
47 // TODO: Check it has a vote!
48 // entropy.actions[0].numberOfVotes().then((count) => {
49 // assert.equal(count, 1);
50 // done();
51 // })
52 })
53 })
54 })
55 });
56 })
57})
58

Built with git-ssb-web