aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/test
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-05-23 00:04:50 +0800
committerGitHub <noreply@github.com>2018-05-23 00:04:50 +0800
commitcc840a6911850856c3254f7ac73cd70c527e1a5c (patch)
treec7435ac7ce09541a67f0106a85f391dc48921e10 /packages/order-utils/test
parenta26cc7c14d4e59102d5f84d534f75c42b8683cad (diff)
parentc4a2f700172e8be367225d90a1c51cef8cf0d7dd (diff)
downloaddexon-sol-tools-cc840a6911850856c3254f7ac73cd70c527e1a5c.tar
dexon-sol-tools-cc840a6911850856c3254f7ac73cd70c527e1a5c.tar.gz
dexon-sol-tools-cc840a6911850856c3254f7ac73cd70c527e1a5c.tar.bz2
dexon-sol-tools-cc840a6911850856c3254f7ac73cd70c527e1a5c.tar.lz
dexon-sol-tools-cc840a6911850856c3254f7ac73cd70c527e1a5c.tar.xz
dexon-sol-tools-cc840a6911850856c3254f7ac73cd70c527e1a5c.tar.zst
dexon-sol-tools-cc840a6911850856c3254f7ac73cd70c527e1a5c.zip
Merge pull request #594 from 0xProject/improvement/addCustomTslintRules
Add more tslint rules
Diffstat (limited to 'packages/order-utils/test')
-rw-r--r--packages/order-utils/test/signature_utils_test.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/order-utils/test/signature_utils_test.ts b/packages/order-utils/test/signature_utils_test.ts
index 4b4de9217..e24fa0ce5 100644
--- a/packages/order-utils/test/signature_utils_test.ts
+++ b/packages/order-utils/test/signature_utils_test.ts
@@ -47,12 +47,13 @@ describe('Signature utils', () => {
});
describe('#generateSalt', () => {
it('generates different salts', () => {
- const equal = generatePseudoRandomSalt().eq(generatePseudoRandomSalt());
- expect(equal).to.be.false();
+ const isEqual = generatePseudoRandomSalt().eq(generatePseudoRandomSalt());
+ expect(isEqual).to.be.false();
});
it('generates salt in range [0..2^256)', () => {
const salt = generatePseudoRandomSalt();
expect(salt.greaterThanOrEqualTo(0)).to.be.true();
+ // tslint:disable-next-line:custom-no-magic-numbers
const twoPow256 = new BigNumber(2).pow(256);
expect(salt.lessThan(twoPow256)).to.be.true();
});
@@ -67,7 +68,8 @@ describe('Signature utils', () => {
expect(isValid).to.be.false();
});
it('returns true if order hash is correct', () => {
- const isValid = isValidOrderHash('0x' + Array(65).join('0'));
+ const orderHashLength = 65;
+ const isValid = isValidOrderHash('0x' + Array(orderHashLength).join('0'));
expect(isValid).to.be.true();
});
});
@@ -111,10 +113,12 @@ describe('Signature utils', () => {
if (payload.method === 'eth_sign') {
const [address, message] = payload.params;
const signature = await web3Wrapper.signMessageAsync(address, message);
+ // tslint:disable-next-line:custom-no-magic-numbers
+ const rsvHex = `0x${signature.substr(130)}${signature.substr(2, 128)}`;
callback(null, {
id: 42,
jsonrpc: '2.0',
- result: `0x${signature.substr(130)}${signature.substr(2, 128)}`,
+ result: rsvHex,
});
} else {
callback(null, { id: 42, jsonrpc: '2.0', result: [makerAddress] });