Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
Added Proper Example Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OnlyOneJMJQ committed Jul 6, 2017
1 parent 554b1d3 commit 5682e34
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 88 deletions.
25 changes: 0 additions & 25 deletions test/TestMetacoin.sol

This file was deleted.

19 changes: 19 additions & 0 deletions test/TestSimpleStorage.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
pragma solidity ^0.4.2;

import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/SimpleStorage.sol";

contract TestSimpleStorage {

function testItStoresAValue() {
SimpleStorage simpleStorage = SimpleStorage(DeployedAddresses.SimpleStorage());

simpleStorage.set(89);

uint expected = 89;

Assert.equal(simpleStorage.get(), expected, "It should store the value 89.");
}

}
63 changes: 0 additions & 63 deletions test/metacoin.js

This file was deleted.

17 changes: 17 additions & 0 deletions test/simplestorage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var SimpleStorage = artifacts.require("./SimpleStorage.sol");

contract('SimpleStorage', function(accounts) {

it("...should store the value 89.", function() {
return SimpleStorage.deployed().then(function(instance) {
simpleStorageInstance = instance;

return simpleStorageInstance.set(89, {from: accounts[0]});
}).then(function() {
return simpleStorageInstance.get.call();
}).then(function(storedData) {
assert.equal(storedData, 89, "The value 89 was not stored.");
});
});

});

0 comments on commit 5682e34

Please sign in to comment.