From d095ba84bf8fe6f2ed1620ca8ee809d2dcf21c7b Mon Sep 17 00:00:00 2001 From: Pavel Rubin Date: Tue, 29 Aug 2017 00:10:40 +0300 Subject: [PATCH] Add tests to check transfers to 0x0 fail --- test/BasicToken.js | 10 ++++++++++ test/StandardToken.js | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/test/BasicToken.js b/test/BasicToken.js index ee9bc9079..76248948a 100644 --- a/test/BasicToken.js +++ b/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); + } + }); + }); diff --git a/test/StandardToken.js b/test/StandardToken.js index 96a51afe5..acf53c31e 100644 --- a/test/StandardToken.js +++ b/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); + } + }); + });