-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
300 additions
and
46 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,51 @@ | ||
# Simple Bank Exercise | ||
|
||
The Simple Bank directory is a truffle project that contains the required contract, migration and test files. In this exercise you are going to implement the SimpleBank.sol contract. | ||
SimpleBank is a [Truffle](https://www.trufflesuite.com/) project that contains | ||
a starter contract, | ||
[migration](https://www.trufflesuite.com/docs/truffle/getting-started/running-migrations#migration-files) | ||
and [Truffle JavaScript test | ||
files](https://www.trufflesuite.com/docs/truffle/testing/writing-tests-in-javascript). | ||
In this exercise you are going to implement the SimpleBank.sol contract. | ||
|
||
The contract contains the framework and comments to implement the contract. Follow the comments outlined in the SimpleBank.sol contract to implement the contract. We have written a set of tests to determine if you implement the contract correctly. | ||
## Files | ||
|
||
To test your implementation start your development blockchain by running truffle develop. From the truffle console, compile and migrate the contracts by running compile and migrate. You can run the pre-written tests by running test. | ||
* `contracts/SimpleBank.sol` | ||
: the partial implementation of a Solidity Contract you will complete. | ||
* `test/simpleBank.test.js` | ||
: the Truffle test file that describes the behavior of a correct SimpleBank | ||
contract. | ||
|
||
If your tests do not pass, modify the contract, recompile, redeploy and retest. Iterate until all of the tests pass. | ||
## Requirements | ||
1. Latest truffle version. | ||
```console | ||
npm -g uninstall truffle && npm -g install truffle | ||
``` | ||
1. Your preferred code editor. | ||
1. Familiarity with terminals. | ||
|
||
## Instructions | ||
|
||
### A note on testing | ||
Follow the comments outlined in SimpleBank.sol to implement its | ||
functionality. The test are there to determine correct contract behavior as | ||
well as guide you through the implementation. | ||
|
||
Check out the testing files to see how tests are implemented in JavaScript. We will go over the details of implementing tests later in the course. | ||
The general workflow is to use Test Drive Development's red green process: | ||
1. Enable a test in `simpleBank.test.js`. This means changing `it.skip`, to | ||
`it` in the test declaration. | ||
2. Run `truffle test` from a terminal. | ||
3. Use the failed test output along with the hints in | ||
`contracts/SimpleBank.sol` to make the test pass. | ||
|
||
<details><summary>Video: Run a test example</summary> | ||
|
||
[![asciicast](https://asciinema.org/a/u3oXwF8qKruSN81sm8MGsmTf0.png)](https://asciinema.org/a/u3oXwF8qKruSN81sm8MGsmTf0) | ||
|
||
</details> | ||
|
||
|
||
### Note on testing | ||
|
||
Check out the testing files to see how tests are implemented in JavaScript. | ||
We will go over the details of implementing tests later in the curriculum. Of | ||
course, if you have questions, do reach out in Slack, or schedule an Office | ||
Hour session with one of our mentors. |
Oops, something went wrong.