-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #254 from willmeister/linting_and_getting_tests_pa…
…ssing Linting and getting tests passing
- Loading branch information
Showing
30 changed files
with
287 additions
and
178 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
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,42 +1,46 @@ | ||
import chai = require('chai') | ||
import {createMockProvider, deployContract, getWallets, solidity} from 'ethereum-waffle'; | ||
import * as BasicTokenMock from '../build/BasicTokenMock.json'; | ||
import { | ||
createMockProvider, | ||
deployContract, | ||
getWallets, | ||
solidity, | ||
} from 'ethereum-waffle' | ||
import * as BasicTokenMock from '../build/BasicTokenMock.json' | ||
|
||
chai.use(solidity); | ||
const {expect} = chai; | ||
chai.use(solidity) | ||
const { expect } = chai | ||
|
||
describe('INTEGRATION: Example', () => { | ||
const provider = createMockProvider(); | ||
const [wallet, walletTo] = getWallets(provider); | ||
let token; | ||
const provider = createMockProvider() | ||
const [wallet, walletTo] = getWallets(provider) | ||
let token | ||
|
||
beforeEach(async () => { | ||
token = await deployContract(wallet, BasicTokenMock, [wallet.address, 1000]); | ||
}); | ||
token = await deployContract(wallet, BasicTokenMock, [wallet.address, 1000]) | ||
}) | ||
|
||
it('Assigns initial balance', async () => { | ||
expect(await token.balanceOf(wallet.address)).to.eq(1000); | ||
}); | ||
expect(await token.balanceOf(wallet.address)).to.eq(1000) | ||
}) | ||
|
||
it('Transfer adds amount to destination account', async () => { | ||
await token.transfer(walletTo.address, 7); | ||
expect(await token.balanceOf(walletTo.address)).to.eq(7); | ||
}); | ||
await token.transfer(walletTo.address, 7) | ||
expect(await token.balanceOf(walletTo.address)).to.eq(7) | ||
}) | ||
|
||
it('Transfer emits event', async () => { | ||
await expect(token.transfer(walletTo.address, 7)) | ||
.to.emit(token, 'Transfer') | ||
.withArgs(wallet.address, walletTo.address, 7); | ||
}); | ||
.withArgs(wallet.address, walletTo.address, 7) | ||
}) | ||
|
||
it('Can not transfer above the amount', async () => { | ||
await expect(token.transfer(walletTo.address, 1007)).to.be.reverted; | ||
}); | ||
await expect(token.transfer(walletTo.address, 1007)).to.be.reverted | ||
}) | ||
|
||
it('Can not transfer from empty account', async () => { | ||
const tokenFromOtherWallet = token.connect(walletTo); | ||
await expect(tokenFromOtherWallet.transfer(wallet.address, 1)) | ||
.to.be.reverted; | ||
}); | ||
|
||
}); | ||
const tokenFromOtherWallet = token.connect(walletTo) | ||
await expect(tokenFromOtherWallet.transfer(wallet.address, 1)).to.be | ||
.reverted | ||
}) | ||
}) |
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
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
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
Oops, something went wrong.