-
Notifications
You must be signed in to change notification settings - Fork 2
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
2 changed files
with
39 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const JobManager = artifacts.require('./JobManager.sol'); | ||
require('truffle-test-utils').init(); | ||
|
||
contract('JobManager', accounts => { | ||
|
||
let jm; | ||
|
||
describe('submitMineral', () => { | ||
|
||
before(async () => { | ||
jm = await JobManager.deployed(); | ||
}); | ||
|
||
it('should store the Mineral in the minerals mapping', async () => { | ||
await jm.submitMineral('multiplication'); | ||
const mineral = await jm.minerals.call(0); | ||
assert.equal('multiplication', mineral); | ||
}); | ||
|
||
it('should increase the value of numberOfMinerals', async () => { | ||
const numberOfMinerals = await jm.numberOfMinerals.call(); | ||
await jm.submitMineral('addition'); | ||
assert.deepEqual(numberOfMinerals.add(1), await jm.numberOfMinerals.call()) | ||
}); | ||
|
||
it('should emit a MineralAdded event', async () => { | ||
let result = await jm.submitMineral('division'); | ||
assert.web3Event(result, { | ||
event: 'MineralAdded', | ||
args: { | ||
id: 2, | ||
name: 'division', | ||
} | ||
}); | ||
}); | ||
}); | ||
}); |