Skip to content

Commit

Permalink
Change name of job function
Browse files Browse the repository at this point in the history
  • Loading branch information
gjgd committed Jul 24, 2018
1 parent 18f5265 commit 99ab8bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion contracts/JobManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ contract JobManager {
return m.category != MineralCategory.Null;
}

function job(uint _mineralId, uint _minPricePerMineral, uint _expirationBlock) external {
function submitJob(uint _mineralId, uint _minPricePerMineral, uint _expirationBlock) external {
// mineralId must correspond to an existing mineral
require(mineralIsValid(_mineralId));
// expirationBlock must be in the future
Expand Down
18 changes: 9 additions & 9 deletions test/JobManager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ contract('JobManager', accounts => {
});
});

describe('job', () => {
describe('submitJob', () => {

let expirationBlock = web3.eth.blockNumber + 1000;

Expand All @@ -69,22 +69,22 @@ contract('JobManager', accounts => {
});

it('should fail if mineralId is not the id of a valid Mineral', async () => {
await assertFail( jm.job(2, 10, expirationBlock) );
await jm.job(0, 10, expirationBlock);
await assertFail( jm.submitJob(2, 10, expirationBlock) );
await jm.submitJob(0, 10, expirationBlock);
});

it('should fail if expiration block is not in the future', async () => {
const blockInThePast = web3.eth.blockNumber;
await assertFail( jm.job(0, 10, blockInThePast) );
await assertFail( jm.submitJob(0, 10, blockInThePast) );
const presentBlock = web3.eth.blockNumber + 1;
await assertFail( jm.job(0, 10, presentBlock) );
await assertFail( jm.submitJob(0, 10, presentBlock) );
const blockInTheFuture = web3.eth.blockNumber + 2;
await jm.job(0, 10, blockInTheFuture);
await jm.submitJob(0, 10, blockInTheFuture);
});

it('should store the Job parameters in the jobs mapping', async () => {
const jobId = await jm.numberOfJobs.call();
await jm.job(1, 11, expirationBlock + 42);
await jm.submitJob(1, 11, expirationBlock + 42);
const job = await jm.jobs.call(jobId);
const [mineralId, minPricePerMineral, expBlock] = job;
assert.equal(1, mineralId);
Expand All @@ -94,7 +94,7 @@ contract('JobManager', accounts => {

it('should emit a JobAdded event', async () => {
const jobId = await jm.numberOfJobs.call();
let result = await jm.job(1, 12, expirationBlock);
let result = await jm.submitJob(1, 12, expirationBlock);
assert.web3Event(result, {
event: 'JobAdded',
args: {
Expand All @@ -108,7 +108,7 @@ contract('JobManager', accounts => {

it('should increment numberOfJobs', async () => {
const numberOfJobs = await jm.numberOfJobs.call();
await jm.job(1, 12, expirationBlock);
await jm.submitJob(1, 12, expirationBlock);
assert.deepEqual(numberOfJobs.add(1), await jm.numberOfJobs.call())
});
});
Expand Down

0 comments on commit 99ab8bf

Please sign in to comment.