Преглед изворни кода

Add tests to check transfers to 0x0 fail

Pavel Rubin пре 8 година
родитељ
комит
d095ba84bf
2 измењених фајлова са 20 додато и 0 уклоњено
  1. 10 0
      test/BasicToken.js
  2. 10 0
      test/StandardToken.js

+ 10 - 0
test/BasicToken.js

@@ -32,4 +32,14 @@ contract('BasicToken', function(accounts) {
     }    
   });
 
+  it("should throw an error when trying to transfer to 0x0", async function() {
+    let token = await StandardTokenMock.new(accounts[0], 100);
+    try {
+      let transfer = await token.transfer(0x0, 100);
+      assert.fail('should have thrown before');
+    } catch(error) {
+      assertJump(error);
+    }    
+  });
+
 });

+ 10 - 0
test/StandardToken.js

@@ -88,4 +88,14 @@ contract('StandardToken', function(accounts) {
     })
   });
 
+  it("should throw an error when trying to transfer to 0x0", async function() {
+    let token = await StandardTokenMock.new(accounts[0], 100);
+    try {
+      let transfer = await token.transfer(0x0, 100);
+      assert.fail('should have thrown before');
+    } catch(error) {
+      assertJump(error);
+    }    
+  });
+
 });