diff options
Diffstat (limited to 'packages/assert')
-rw-r--r-- | packages/assert/src/index.ts | 7 | ||||
-rw-r--r-- | packages/assert/test/assert_test.ts | 12 | ||||
-rw-r--r-- | packages/assert/tsconfig.json | 17 |
3 files changed, 6 insertions, 30 deletions
diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts index 051a741c5..56f663780 100644 --- a/packages/assert/src/index.ts +++ b/packages/assert/src/index.ts @@ -18,9 +18,6 @@ export const assert = { `${variableName} should be in baseUnits (no decimals), found value: ${value.toNumber()}`, ); }, - isUndefined(value: any, variableName?: string): void { - this.assert(_.isUndefined(value), this.typeAssertionMessage(variableName, 'undefined', value)); - }, isString(variableName: string, value: string): void { this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value)); }, @@ -77,11 +74,11 @@ Validation errors: ${validationResult.errors.join(', ')}`; this.assert(!hasValidationErrors, msg); }, isHttpUrl(variableName: string, value: any): void { - const isValidUrl = validUrl.isWebUri(value); + const isValidUrl = !_.isUndefined(validUrl.isWebUri(value)); this.assert(isValidUrl, this.typeAssertionMessage(variableName, 'http url', value)); }, isUri(variableName: string, value: any): void { - const isValidUri = validUrl.isUri(value); + const isValidUri = !_.isUndefined(validUrl.isUri(value)); this.assert(isValidUri, this.typeAssertionMessage(variableName, 'uri', value)); }, assert(condition: boolean, message: string): void { diff --git a/packages/assert/test/assert_test.ts b/packages/assert/test/assert_test.ts index 29344584a..ff337196d 100644 --- a/packages/assert/test/assert_test.ts +++ b/packages/assert/test/assert_test.ts @@ -22,16 +22,6 @@ describe('Assertions', () => { invalidInputs.forEach(input => expect(assert.isBigNumber.bind(assert, variableName, input)).to.throw()); }); }); - describe('#isUndefined', () => { - it('should not throw for valid input', () => { - const validInputs = [undefined]; - validInputs.forEach(input => expect(assert.isUndefined.bind(assert, input, variableName)).to.not.throw()); - }); - it('should throw for invalid input', () => { - const invalidInputs = ['test', 42, false, { random: 'test' }]; - invalidInputs.forEach(input => expect(assert.isUndefined.bind(assert, input, variableName)).to.throw()); - }); - }); describe('#isString', () => { it('should not throw for valid input', () => { const validInputs = ['hello', 'goodbye']; @@ -44,7 +34,7 @@ describe('Assertions', () => { }); describe('#isFunction', () => { it('should not throw for valid input', () => { - const validInputs = [BigNumber, assert.isString.bind(this)]; + const validInputs = [BigNumber, assert.isString]; validInputs.forEach(input => expect(assert.isFunction.bind(assert, variableName, input)).to.not.throw()); }); it('should throw for invalid input', () => { diff --git a/packages/assert/tsconfig.json b/packages/assert/tsconfig.json index 31bedfeb7..88a467ccb 100644 --- a/packages/assert/tsconfig.json +++ b/packages/assert/tsconfig.json @@ -1,18 +1,7 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2017", "dom"], - "outDir": "lib", - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "strictNullChecks": true + "outDir": "lib" }, - "include": [ - "./src/**/*", - "./test/**/*", - "../../node_modules/chai-typescript-typings/index.d.ts", - "../../node_modules/web3-typescript-typings/index.d.ts" - ] + "include": ["./src/**/*", "./test/**/*", "../../node_modules/chai-typescript-typings/index.d.ts"] } |