git ssb

0+

dangerousbeans / Entropy_contracts



Commit 8c8b7da9dc43699fc6a0d49a9c8ba2ccf4075672

better organised tests

Joran committed on 12/13/2016, 4:15:23 AM
Parent: e2d16c3510e7763b548d4c0110a89fa0924236d6

Files changed

contracts/Entropy.solchanged
test/Entropy_actions.jschanged
test/Entropy_token.jschanged
contracts/Entropy.solView
@@ -97,9 +97,11 @@
9797
9898 /**
9999 * Alters the safety limit for the maximum value of tokens bought
100100 */
101- function changeSafeyLimit(uint _new_limit) onlyGuardians returns (bool success) {
101 + function changeSafeyLimit(uint _new_limit)
102 + onlyGuardians // 💂
103 + returns (bool success) {
102104 // Limit can only be increased
103105 if(_new_limit < safety_limit) throw;
104106
105107 // Set new safety limit
test/Entropy_actions.jsView
@@ -4,31 +4,50 @@
44 /**
55 * Actions
66 *
77 */
8- it("stops untrusted Citizens from creating actions", (done) => {
9- helpers.deployEntropyContract()
10- .then((entropy) => {
11- return helpers.expectedExceptionPromise(() => {
12- return entropy.newAction(1e18, "Rigging refit", { from: accounts[1]});
13- }, 3000000)
14- .then(()=>{
15- entropy.actions_count().then((actions_count) => {
16- assert.equal(actions_count, 0);
17- done();
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 + })
1821 })
1922 })
20- })
21- });
23 + });
2224
23- it("lets trusted Citizens create actions", (done) => {
24- helpers.deployEntropyContract()
25- .then((entropy) => {
26- entropy.newAction(1e18, "Rigging refit").then((tx) => {
27- entropy.actions_count().then((actions_count) => {
28- assert.equal(actions_count, 1);
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() })
2933 })
30- .then(()=>{ done() })
3134 })
3235 })
33- });
36 + })
37 +
38 + describe("Voting", () =>{
39 + it("lets trusted citizens vote", (done) => {
40 + helpers.deployEntropyContract()
41 + .then((entropy) => {
42 + entropy.newAction(1e18, "Rigging refit").then((tx) => {
43 + entropy.actions_count().then((actions_count) => {
44 + assert.equal(actions_count, 1);
45 + })
46 + .then(()=>{ done() })
47 + })
48 + })
49 + });
50 +
51 + })
52 +
3453 })
test/Entropy_token.jsView
@@ -49,9 +49,8 @@
4949 })
5050 })
5151
5252 describe("Safety Limit", () => {
53-
5453 it("is ok near the safety limit", function(done) {
5554 helpers.deployEntropyContract()
5655 .then((entropy) => {
5756 // Send 299 Eth

Built with git-ssb-web