Ran prettier

This commit is contained in:
Alex Towle 2019-07-30 09:49:57 -07:00
parent 03fced81f5
commit b2ada13a21
5 changed files with 22 additions and 46 deletions

View File

@ -16,11 +16,7 @@ describe('LibAddress', () => {
await blockchainLifecycle.startAsync();
nonContract = (await web3Wrapper.getAvailableAddressesAsync())[0];
// Deploy LibAddress
lib = await TestLibAddressContract.deployFrom0xArtifactAsync(
artifacts.TestLibAddress,
provider,
txDefaults,
);
lib = await TestLibAddressContract.deployFrom0xArtifactAsync(artifacts.TestLibAddress, provider, txDefaults);
});
after(async () => {

View File

@ -52,12 +52,11 @@ async function testHashEIP712MessageAsync(
domainHash: string,
hashStruct: string,
): Promise<void> {
const input = '0x1901'.concat(domainHash.slice(2, domainHash.length).concat(hashStruct.slice(2, hashStruct.length)));
const expectedHash = '0x'.concat(ethUtil.sha3(input).toString('hex'));
const actualHash = await lib.externalHashEIP712Message.callAsync(
domainHash,
hashStruct,
const input = '0x1901'.concat(
domainHash.slice(2, domainHash.length).concat(hashStruct.slice(2, hashStruct.length)),
);
const expectedHash = '0x'.concat(ethUtil.sha3(input).toString('hex'));
const actualHash = await lib.externalHashEIP712Message.callAsync(domainHash, hashStruct);
expect(actualHash).to.be.eq(expectedHash);
}
@ -67,11 +66,7 @@ describe('LibEIP712', () => {
before(async () => {
await blockchainLifecycle.startAsync();
// Deploy SafeMath
lib = await TestLibEIP712Contract.deployFrom0xArtifactAsync(
artifacts.TestLibEIP712,
provider,
txDefaults,
);
lib = await TestLibEIP712Contract.deployFrom0xArtifactAsync(artifacts.TestLibEIP712, provider, txDefaults);
});
after(async () => {
@ -80,13 +75,7 @@ describe('LibEIP712', () => {
describe('_hashEIP712Domain', async () => {
it('should correctly hash empty input', async () => {
await testHashEIP712DomainAsync(
lib,
'',
'',
0,
constants.NULL_ADDRESS,
);
await testHashEIP712DomainAsync(lib, '', '', 0, constants.NULL_ADDRESS);
});
});
@ -97,11 +86,7 @@ describe('LibEIP712', () => {
const actualHash = await lib.externalHashEIP712Message.callAsync(constants.NULL_BYTES32, constants.NULL_BYTES32);
expect(actualHash).to.be.eq(expectedHash);
*/
await testHashEIP712MessageAsync(
lib,
constants.NULL_BYTES32,
constants.NULL_BYTES32,
);
await testHashEIP712MessageAsync(lib, constants.NULL_BYTES32, constants.NULL_BYTES32);
});
});
});

View File

@ -22,11 +22,7 @@ describe('Ownable', () => {
await blockchainLifecycle.startAsync();
// Deploy SafeMath from the owner address
txDefaults.from = owner;
ownable = await TestOwnableContract.deployFrom0xArtifactAsync(
artifacts.TestOwnable,
provider,
txDefaults,
);
ownable = await TestOwnableContract.deployFrom0xArtifactAsync(artifacts.TestOwnable, provider, txDefaults);
});
after(async () => {
@ -36,10 +32,7 @@ describe('Ownable', () => {
// tslint:disable:no-unused-expression
describe('onlyOwner', () => {
it('should throw if sender is not owner', async () => {
const expectedError = new OwnableRevertErrors.OnlyOwnerError(
nonOwner,
owner,
);
const expectedError = new OwnableRevertErrors.OnlyOwnerError(nonOwner, owner);
return expect(ownable.externalOnlyOwner.callAsync({ from: nonOwner })).to.revertWith(expectedError);
});
@ -50,7 +43,8 @@ describe('Ownable', () => {
describe('transferOwnership', () => {
it('should not transfer ownership if the specified new owner is the zero address', async () => {
expect(ownable.transferOwnership.sendTransactionAsync(constants.NULL_ADDRESS, { from: owner })).to.be.fulfilled;
expect(ownable.transferOwnership.sendTransactionAsync(constants.NULL_ADDRESS, { from: owner })).to.be
.fulfilled;
const updatedOwner = await ownable.owner.callAsync();
expect(updatedOwner).to.be.eq(owner);
});

View File

@ -20,11 +20,7 @@ describe('SafeMath', () => {
before(async () => {
await blockchainLifecycle.startAsync();
// Deploy SafeMath
safeMath = await TestSafeMathContract.deployFrom0xArtifactAsync(
artifacts.TestSafeMath,
provider,
txDefaults,
);
safeMath = await TestSafeMathContract.deployFrom0xArtifactAsync(artifacts.TestSafeMath, provider, txDefaults);
});
after(async () => {
@ -53,7 +49,7 @@ describe('SafeMath', () => {
return expect(safeMath.externalSafeMul.callAsync(a, b)).to.revertWith(expectedError);
});
it('should calculate correct value for values that don\'t overflow', async () => {
it("should calculate correct value for values that don't overflow", async () => {
const result = await safeMath.externalSafeMul.callAsync(toBN(15), toBN(13));
expect(result).bignumber.to.be.eq(toBN(195));
});

View File

@ -1,11 +1,16 @@
import { EIP712DomainWithDefaultSchema, EIP712Object, EIP712ObjectValue, EIP712TypedData, EIP712Types } from '@0x/types';
import {
EIP712DomainWithDefaultSchema,
EIP712Object,
EIP712ObjectValue,
EIP712TypedData,
EIP712Types,
} from '@0x/types';
import * as ethUtil from 'ethereumjs-util';
import * as ethers from 'ethers';
import * as _ from 'lodash';
import { BigNumber } from './configured_bignumber';
export const signTypedDataUtils = {
/**
* Generates the EIP712 Typed Data hash for signing
@ -39,7 +44,7 @@ export const signTypedDataUtils = {
{ name: 'version', type: 'string' },
{ name: 'chainId', type: 'uint256' },
{ name: 'verifyingContractAddress', type: 'address' },
]
],
} as EIP712Types,
);
},