Bug fixes And add Unit Test
This commit is contained in:
parent
a4e84eff45
commit
5caf069681
5 changed files with 5862 additions and 3 deletions
|
@ -6,4 +6,21 @@ contract("HelloEthSalon:GetMessage", function (accounts) {
|
|||
const result = await contract.GetMessage.call();
|
||||
assert.isTrue(result === "I know smart contract testing!!");
|
||||
});
|
||||
});
|
||||
|
||||
contract("HelloEthSalon:SetMessage", function (accounts) {
|
||||
|
||||
it("should not set a empty string", async function () {
|
||||
const contract = await HelloEthSalon.deployed();
|
||||
var ret = false;
|
||||
try{const result = await contract.SetMessage.call("");}catch (e){ret = true;}
|
||||
assert.isTrue(ret);
|
||||
});
|
||||
|
||||
it("should set to test", async function () {
|
||||
const contract = await HelloEthSalon.deployed();
|
||||
var ret = false;
|
||||
try{const result = await contract.SetMessage.call("test");}catch (e){ret = true;}
|
||||
assert.isTrue(!ret,"Erreur de transaction"); // Pas d'erreur de transaction
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue