Skip to content

Commit

Permalink
Updated Address.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
EC2 Default User committed Jun 22, 2019
1 parent 44bf3fd commit d29a9b7
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions test/utils/Address.test.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
require('openzeppelin-test-helpers');

const { constants } = require('openzeppelin-test-helpers');
const { expect } = require('chai');

const AddressImpl = artifacts.require('AddressImpl');
const SimpleToken = artifacts.require('SimpleToken');

contract('Address', function ([_, other]) {
const ALL_ONES_ADDRESS = '0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF';

beforeEach(async function () {
this.mock = await AddressImpl.new();
});

it('should return false for account address', async function () {
expect(await this.mock.isContract(other)).to.equal(false);
describe('isContract', function () {
it('should return false for account address', async function () {
expect(await this.mock.isContract(other)).to.equal(false);
});

it('should return true for contract address', async function () {
const contract = await SimpleToken.new();
expect(await this.mock.isContract(contract.address)).to.equal(true);
});
});

it('should return true for contract address', async function () {
const contract = await SimpleToken.new();
expect(await this.mock.isContract(contract.address)).to.equal(true);
describe('toPayable', function () {
it('should return a payable address when the account is the zero address', async function () {
expect(await this.mock.toPayable(constants.ZERO_ADDRESS)).to.equal(constants.ZERO_ADDRESS);
});

it('should return a payable address when the account is an arbitrary address', async function () {
expect(await this.mock.toPayable(other)).to.equal(other);
});

it('should return a payable address when the account is the all ones address', async function () {
expect(await this.mock.toPayable(ALL_ONES_ADDRESS)).to.equal(ALL_ONES_ADDRESS);
});
});
});

0 comments on commit d29a9b7

Please sign in to comment.