This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Election = artifacts.require("./Election.sol"); | |
| module.exports = function(deployer) { | |
| deployer.deploy(Election); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pragma solidity 0.4.24; | |
| contract Election { | |
| // Read/write candidate | |
| string public candidate; | |
| // Constructor | |
| constructor () public { | |
| candidate = "Candidate 1"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App = { | |
| web3Provider: null, | |
| contracts: {}, | |
| account: '0x0', | |
| init: function() { | |
| return App.initWeb3(); | |
| }, | |
| initWeb3: function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Election = artifacts.require("./Election.sol"); | |
| contract("Election", function(accounts) { | |
| var electionInstance; | |
| it("initializes with two candidates", function() { | |
| return Election.deployed().then(function(instance) { | |
| return instance.candidatesCount(); | |
| }).then(function(count) { | |
| assert.equal(count, 2); |
NewerOlder