Skip to content

Instantly share code, notes, and snippets.

@amazingandyyy
Last active November 19, 2017 08:16
Show Gist options
  • Save amazingandyyy/02ea2e82a24122eeaf0502f22191ca5d to your computer and use it in GitHub Desktop.
Save amazingandyyy/02ea2e82a24122eeaf0502f22191ca5d to your computer and use it in GitHub Desktop.
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!!");
});
});
@amazingandyyy
Copy link
Author

here is callback version (in my old tutorials)

var HelloEthSalon = artifacts.require('./HelloEthSalon.sol');

contract('HelloEthSalon:GetMessage', function(accounts) {
  it("should return a correct string", function(done) {
    var hello_eth_salon = HelloEthSalon.deployed();
    hello_eth_salon.then(function(contract){
      return contract.GetMessage.call();
    }).then(function(result){
      assert.isTrue(result === 'I know testing of a contract!!');
      done();
    })
  });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment