|
1 |
| -require('openzeppelin-test-helpers'); |
| 1 | +const { constants } = require('openzeppelin-test-helpers'); |
2 | 2 |
|
3 | 3 | const AddressImpl = artifacts.require('AddressImpl');
|
4 | 4 | const SimpleToken = artifacts.require('SimpleToken');
|
5 | 5 |
|
6 | 6 | contract('Address', function ([_, other]) {
|
| 7 | + const ALL_ONES_ADDRESS = '0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF'; |
| 8 | + |
7 | 9 | beforeEach(async function () {
|
8 | 10 | this.mock = await AddressImpl.new();
|
9 | 11 | });
|
10 | 12 |
|
11 |
| - it('should return false for account address', async function () { |
12 |
| - (await this.mock.isContract(other)).should.equal(false); |
| 13 | + describe('isContract', function () { |
| 14 | + it('should return false for account address', async function () { |
| 15 | + (await this.mock.isContract(other)).should.equal(false); |
| 16 | + }); |
| 17 | + |
| 18 | + it('should return true for contract address', async function () { |
| 19 | + const contract = await SimpleToken.new(); |
| 20 | + (await this.mock.isContract(contract.address)).should.equal(true); |
| 21 | + }); |
13 | 22 | });
|
14 | 23 |
|
15 |
| - it('should return true for contract address', async function () { |
16 |
| - const contract = await SimpleToken.new(); |
17 |
| - (await this.mock.isContract(contract.address)).should.equal(true); |
| 24 | + describe('toPayable', function () { |
| 25 | + it('should return a payable address when the account is the zero address', async function () { |
| 26 | + (await this.mock.toPayable(constants.ZERO_ADDRESS)).should.equal(constants.ZERO_ADDRESS); |
| 27 | + }); |
| 28 | + |
| 29 | + it('should return a payable address when the account is an arbitrary address', async function () { |
| 30 | + (await this.mock.toPayable(other)).should.equal(other); |
| 31 | + }); |
| 32 | + |
| 33 | + it('should return a payable address when the account is the all ones address', async function () { |
| 34 | + (await this.mock.toPayable(ALL_ONES_ADDRESS)).should.equal(ALL_ONES_ADDRESS); |
| 35 | + }); |
18 | 36 | });
|
19 | 37 | });
|
0 commit comments