git ssb

0+

dangerousbeans / Entropy_contracts



Tree: add0bd87861d967eab275b060a95b4f5576f5d59

Files: add0bd87861d967eab275b060a95b4f5576f5d59 / test / Entropy_actions.js

1694 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.actions_count().then((actions_count) => {
29 assert.equal(actions_count, 0);
30 })
31
32 entropy.newAction(1e18, "Rigging refit").then((tx) => {
33 entropy.actions_count().then((actions_count) => {
34 assert.equal(actions_count, 1);
35 })
36 .then(()=>{ done() })
37 })
38 })
39 })
40 })
41
42 describe("Voting", () =>{
43 it("lets trusted citizens vote", (done) => {
44 helpers.deployEntropyContract()
45 .then((entropy) => {
46 entropy.newAction(1e18, "Rigging refit")
47 .then((tx) => {
48 // Vote in favour!
49 entropy.vote(0, true).then((tx) => {
50 done();
51 // TODO: Check it has a vote!
52 // entropy.actions[0].numberOfVotes().then((count) => {
53 // assert.equal(count, 1);
54 // done();
55 // })
56 })
57 })
58 })
59 });
60 })
61})
62

Built with git-ssb-web