aboutsummaryrefslogtreecommitdiffstats
path: root/contracts
diff options
context:
space:
mode:
authorkao <zichongkao@gmail.com>2018-12-08 08:35:00 +0800
committerkao <zichongkao@gmail.com>2018-12-08 09:06:52 +0800
commitf14603ca4d91ca72d9e81de53168230d85bc50aa (patch)
tree69eecd797c8c28f1b51513ffe01e7ab5e2104df1 /contracts
parentaa4fcebdc71fa58b12dc12ab03d7697444416c09 (diff)
downloaddexon-sol-tools-f14603ca4d91ca72d9e81de53168230d85bc50aa.tar
dexon-sol-tools-f14603ca4d91ca72d9e81de53168230d85bc50aa.tar.gz
dexon-sol-tools-f14603ca4d91ca72d9e81de53168230d85bc50aa.tar.bz2
dexon-sol-tools-f14603ca4d91ca72d9e81de53168230d85bc50aa.tar.lz
dexon-sol-tools-f14603ca4d91ca72d9e81de53168230d85bc50aa.tar.xz
dexon-sol-tools-f14603ca4d91ca72d9e81de53168230d85bc50aa.tar.zst
dexon-sol-tools-f14603ca4d91ca72d9e81de53168230d85bc50aa.zip
Implement prefer-template tslint rule
Diffstat (limited to 'contracts')
-rw-r--r--contracts/core/test/exchange/signature_validator.ts6
-rw-r--r--contracts/core/test/utils/exchange_wrapper.ts2
-rw-r--r--contracts/test-utils/src/assertions.ts2
-rw-r--r--contracts/utils/test/lib_bytes.ts2
4 files changed, 6 insertions, 6 deletions
diff --git a/contracts/core/test/exchange/signature_validator.ts b/contracts/core/test/exchange/signature_validator.ts
index b84a488a1..ee751efac 100644
--- a/contracts/core/test/exchange/signature_validator.ts
+++ b/contracts/core/test/exchange/signature_validator.ts
@@ -135,7 +135,7 @@ describe('MixinSignatureValidator', () => {
it('should revert when signature type is unsupported', async () => {
const unsupportedSignatureType = SignatureType.NSignatureTypes;
- const unsupportedSignatureHex = '0x' + Buffer.from([unsupportedSignatureType]).toString('hex');
+ const unsupportedSignatureHex = `0x${Buffer.from([unsupportedSignatureType]).toString('hex')}`;
const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
return expectContractCallFailedAsync(
signatureValidator.publicIsValidSignature.callAsync(
@@ -148,7 +148,7 @@ describe('MixinSignatureValidator', () => {
});
it('should revert when SignatureType=Illegal', async () => {
- const unsupportedSignatureHex = '0x' + Buffer.from([SignatureType.Illegal]).toString('hex');
+ const unsupportedSignatureHex = `0x${Buffer.from([SignatureType.Illegal]).toString('hex')}`;
const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
return expectContractCallFailedAsync(
signatureValidator.publicIsValidSignature.callAsync(
@@ -161,7 +161,7 @@ describe('MixinSignatureValidator', () => {
});
it('should return false when SignatureType=Invalid and signature has a length of zero', async () => {
- const signatureHex = '0x' + Buffer.from([SignatureType.Invalid]).toString('hex');
+ const signatureHex = `0x${Buffer.from([SignatureType.Invalid]).toString('hex')}`;
const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
orderHashHex,
diff --git a/contracts/core/test/utils/exchange_wrapper.ts b/contracts/core/test/utils/exchange_wrapper.ts
index 2a24b880f..79d298851 100644
--- a/contracts/core/test/utils/exchange_wrapper.ts
+++ b/contracts/core/test/utils/exchange_wrapper.ts
@@ -228,7 +228,7 @@ export class ExchangeWrapper {
return orderEpoch;
}
public async getOrderInfoAsync(signedOrder: SignedOrder): Promise<OrderInfo> {
- const orderInfo = (await this._exchange.getOrderInfo.callAsync(signedOrder)) as OrderInfo;
+ const orderInfo = await this._exchange.getOrderInfo.callAsync(signedOrder);
return orderInfo;
}
public async getOrdersInfoAsync(signedOrders: SignedOrder[]): Promise<OrderInfo[]> {
diff --git a/contracts/test-utils/src/assertions.ts b/contracts/test-utils/src/assertions.ts
index 5b1cedfcc..b1dec1281 100644
--- a/contracts/test-utils/src/assertions.ts
+++ b/contracts/test-utils/src/assertions.ts
@@ -137,7 +137,7 @@ export async function expectTransactionFailedWithoutReasonAsync(p: sendTransacti
// directly.
txReceiptStatus = result.status;
} else {
- throw new Error('Unexpected result type: ' + typeof result);
+ throw new Error(`Unexpected result type: ${typeof result}`);
}
expect(_.toString(txReceiptStatus)).to.equal(
'0',
diff --git a/contracts/utils/test/lib_bytes.ts b/contracts/utils/test/lib_bytes.ts
index 985a98943..6fb859c67 100644
--- a/contracts/utils/test/lib_bytes.ts
+++ b/contracts/utils/test/lib_bytes.ts
@@ -25,7 +25,7 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
// BUG: Ideally we would use Buffer.from(memory).toString('hex')
// https://github.com/Microsoft/TypeScript/issues/23155
-const toHex = (buf: Uint8Array): string => buf.reduce((a, v) => a + ('00' + v.toString(16)).slice(-2), '0x');
+const toHex = (buf: Uint8Array): string => buf.reduce((a, v) => a + `00${v.toString(16)}`.slice(-2), '0x');
const fromHex = (str: string): Uint8Array => Uint8Array.from(Buffer.from(str.slice(2), 'hex'));