Add Unit Test

This commit is contained in:
MrDev023 2018-02-01 11:52:53 +01:00
parent 5286c07296
commit 3304c1a738
7 changed files with 44 additions and 14 deletions

4
.gitignore vendored
View file

@ -1,3 +1,5 @@
data/*
node_modules/*
*.json
*.json
bin/*
build/*

View file

@ -1,13 +0,0 @@
pragma solidity ^0.4.18;
contract Test {
int256 a = 0;
function set(int256 n) public {
a += n;
}
function get() public constant returns(int256) {
return a;
}
}

View file

@ -0,0 +1,13 @@
pragma solidity ^0.4.4;
contract HelloEthSalon {
string message = "I know smart contract testing!!";
function HelloEthSalon() {
// constructor
}
function GetMessage() returns (string) {
return message;
}
}

View file

@ -0,0 +1,5 @@
var HelloEthSalon = artifacts.require('./HelloEthSalon.sol');
module.exports = function(deployer) {
deployer.deploy(HelloEthSalon);
};

9
test/hello_eth_salon.js Normal file
View file

@ -0,0 +1,9 @@
var HelloEthSalon = artifacts.require("./HelloEthSalon.sol");
contract("HelloEthSalon:GetMessage", function (accounts) {
it("should return a correct string", async function () {
const contract = await HelloEthSalon.deployed();
const result = await contract.GetMessage.call();
assert.isTrue(result === "I know smart contract testing!!");
});
});

4
truffle-config.js Normal file
View file

@ -0,0 +1,4 @@
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
};

10
truffle.js Normal file
View file

@ -0,0 +1,10 @@
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*", // Match any network id
gas: 4700000
}
}
};