diff options
Diffstat (limited to 'packages/assert')
-rw-r--r-- | packages/assert/package.json | 2 | ||||
-rw-r--r-- | packages/assert/src/index.ts | 10 | ||||
-rw-r--r-- | packages/assert/test/assert_test.ts | 11 |
3 files changed, 12 insertions, 11 deletions
diff --git a/packages/assert/package.json b/packages/assert/package.json index d0f40c66e..61eea2de7 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -7,7 +7,7 @@ "scripts": { "build": "tsc", "clean": "shx rm -rf _bundles lib test_temp", - "lint": "tslint src/**/*.ts test/**/*.ts", + "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", "run_mocha": "mocha lib/test/**/*_test.js", "prepublishOnly": "run-p build", "test": "run-s clean build run_mocha", diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts index eb224223f..92bcf6f03 100644 --- a/packages/assert/src/index.ts +++ b/packages/assert/src/index.ts @@ -1,11 +1,11 @@ +import { + Schema, + SchemaValidator, +} from '@0xproject/json-schemas'; import BigNumber from 'bignumber.js'; import * as ethereum_address from 'ethereum-address'; import * as _ from 'lodash'; import * as validUrl from 'valid-url'; -import { - SchemaValidator, - Schema, -} from '@0xproject/json-schemas'; const HEX_REGEX = /^0x[0-9A-F]*$/i; @@ -62,7 +62,7 @@ export const assert = { this.assert(_.isBoolean(value), this.typeAssertionMessage(variableName, 'boolean', value)); }, isWeb3Provider(variableName: string, value: any): void { - const isWeb3Provider = _.isFunction((value as any).send) || _.isFunction((value as any).sendAsync); + const isWeb3Provider = _.isFunction((value).send) || _.isFunction((value).sendAsync); this.assert(isWeb3Provider, this.typeAssertionMessage(variableName, 'Web3.Provider', value)); }, doesConformToSchema(variableName: string, value: any, schema: Schema): void { diff --git a/packages/assert/test/assert_test.ts b/packages/assert/test/assert_test.ts index 66fa4eb54..5fa96e49a 100644 --- a/packages/assert/test/assert_test.ts +++ b/packages/assert/test/assert_test.ts @@ -1,8 +1,9 @@ -import 'mocha'; -import * as dirtyChai from 'dirty-chai'; -import * as chai from 'chai'; -import {BigNumber} from 'bignumber.js'; import {schemas} from '@0xproject/json-schemas'; +import {BigNumber} from 'bignumber.js'; +import * as chai from 'chai'; +import * as dirtyChai from 'dirty-chai'; +import 'mocha'; + import {assert} from '../src/index'; chai.config.includeStack = true; @@ -183,7 +184,7 @@ describe('Assertions', () => { it('should not throw for valid input', () => { const validInputs = [ 42, - 0.00, + 0, 21e+42, ]; validInputs.forEach(input => expect(assert.isNumber.bind(assert, variableName, input)).to.not.throw()); |