aboutsummaryrefslogtreecommitdiffstats
path: root/packages/json-schemas
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/json-schemas
parenta26cc7c14d4e59102d5f84d534f75c42b8683cad (diff)
parentc4a2f700172e8be367225d90a1c51cef8cf0d7dd (diff)
downloaddexon-0x-contracts-cc840a6911850856c3254f7ac73cd70c527e1a5c.tar
dexon-0x-contracts-cc840a6911850856c3254f7ac73cd70c527e1a5c.tar.gz
dexon-0x-contracts-cc840a6911850856c3254f7ac73cd70c527e1a5c.tar.bz2
dexon-0x-contracts-cc840a6911850856c3254f7ac73cd70c527e1a5c.tar.lz
dexon-0x-contracts-cc840a6911850856c3254f7ac73cd70c527e1a5c.tar.xz
dexon-0x-contracts-cc840a6911850856c3254f7ac73cd70c527e1a5c.tar.zst
dexon-0x-contracts-cc840a6911850856c3254f7ac73cd70c527e1a5c.zip
Merge pull request #594 from 0xProject/improvement/addCustomTslintRules
Add more tslint rules
Diffstat (limited to 'packages/json-schemas')
-rw-r--r--packages/json-schemas/test/schema_test.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/packages/json-schemas/test/schema_test.ts b/packages/json-schemas/test/schema_test.ts
index ac6a68b59..b9574a0c9 100644
--- a/packages/json-schemas/test/schema_test.ts
+++ b/packages/json-schemas/test/schema_test.ts
@@ -149,7 +149,8 @@ describe('Schema', () => {
});
describe('#blockParamSchema', () => {
it('should validate valid block param', () => {
- const testCases = [42, 'latest', 'pending', 'earliest'];
+ const blockNumber = 42;
+ const testCases = [blockNumber, 'latest', 'pending', 'earliest'];
validateAgainstSchema(testCases, blockParamSchema);
});
it('should fail for invalid block param', () => {
@@ -182,6 +183,7 @@ describe('Schema', () => {
validateAgainstSchema(testCases, tokenSchema);
});
it('should fail for invalid token', () => {
+ const num = 4;
const testCases = [
{
...token,
@@ -192,7 +194,7 @@ describe('Schema', () => {
decimals: undefined,
},
[],
- 4,
+ num,
];
const shouldFail = true;
validateAgainstSchema(testCases, tokenSchema, shouldFail);
@@ -871,10 +873,12 @@ describe('Schema', () => {
});
describe('#jsNumberSchema', () => {
it('should validate valid js number', () => {
+ // tslint:disable-next-line:custom-no-magic-numbers
const testCases = [1, 42];
validateAgainstSchema(testCases, jsNumber);
});
it('should fail for invalid js number', () => {
+ // tslint:disable-next-line:custom-no-magic-numbers
const testCases = [NaN, -1, new BigNumber(1)];
const shouldFail = true;
validateAgainstSchema(testCases, jsNumber, shouldFail);
@@ -882,13 +886,14 @@ describe('Schema', () => {
});
describe('#txDataSchema', () => {
it('should validate valid txData', () => {
+ const bigNumGasAmount = new BigNumber(42);
const testCases = [
{
from: NULL_ADDRESS,
},
{
from: NULL_ADDRESS,
- gas: new BigNumber(42),
+ gas: bigNumGasAmount,
},
{
from: NULL_ADDRESS,