diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-03-06 07:24:55 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-03-06 07:24:55 +0800 |
commit | 08ab81c54c1e845a4239648e8cea65a930fcc99d (patch) | |
tree | 4ac86f7f4b2d4a9dff5ab72ad90983203bf0d11b | |
parent | d355382f7040550cb82bab57a4935652fb710e71 (diff) | |
download | dexon-0x-contracts-08ab81c54c1e845a4239648e8cea65a930fcc99d.tar.gz dexon-0x-contracts-08ab81c54c1e845a4239648e8cea65a930fcc99d.tar.zst dexon-0x-contracts-08ab81c54c1e845a4239648e8cea65a930fcc99d.zip |
Rename isHttpUrl to isWebUri in assert package
-rw-r--r-- | packages/assert/CHANGELOG.md | 4 | ||||
-rw-r--r-- | packages/assert/src/index.ts | 4 | ||||
-rw-r--r-- | packages/assert/test/assert_test.ts | 6 | ||||
-rw-r--r-- | packages/connect/src/http_client.ts | 2 | ||||
-rw-r--r-- | packages/sra-report/src/index.ts | 2 |
5 files changed, 11 insertions, 7 deletions
diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md index b37a810e3..35bf4faef 100644 --- a/packages/assert/CHANGELOG.md +++ b/packages/assert/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## v0.2.0 - _TBD, 2018_ + + * Rename `isHttpUrl` to `isWebUri` (#412) + ## v0.1.0 - _March 4, 2018_ * Remove isETHAddressHex checksum address check and assume address will be lowercased (#373) diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts index 40d083cb6..171909c93 100644 --- a/packages/assert/src/index.ts +++ b/packages/assert/src/index.ts @@ -75,9 +75,9 @@ Encountered: ${JSON.stringify(value, null, '\t')} Validation errors: ${validationResult.errors.join(', ')}`; this.assert(!hasValidationErrors, msg); }, - isHttpUrl(variableName: string, value: any): void { + isWebUri(variableName: string, value: any): void { const isValidUrl = !_.isUndefined(validUrl.isWebUri(value)); - this.assert(isValidUrl, this.typeAssertionMessage(variableName, 'http url', value)); + this.assert(isValidUrl, this.typeAssertionMessage(variableName, 'web uri', value)); }, isUri(variableName: string, value: any): void { const isValidUri = !_.isUndefined(validUrl.isUri(value)); diff --git a/packages/assert/test/assert_test.ts b/packages/assert/test/assert_test.ts index b0fa398d6..1d9a34ed9 100644 --- a/packages/assert/test/assert_test.ts +++ b/packages/assert/test/assert_test.ts @@ -183,7 +183,7 @@ describe('Assertions', () => { ); }); }); - describe('#isHttpUrl', () => { + describe('#isWebUri', () => { it('should not throw for valid input', () => { const validInputs = [ 'http://www.google.com', @@ -191,7 +191,7 @@ describe('Assertions', () => { 'https://api.radarrelay.com/0x/v0/', 'https://zeroex.beta.radarrelay.com:8000/0x/v0/', ]; - validInputs.forEach(input => expect(assert.isHttpUrl.bind(assert, variableName, input)).to.not.throw()); + validInputs.forEach(input => expect(assert.isWebUri.bind(assert, variableName, input)).to.not.throw()); }); it('should throw for invalid input', () => { const invalidInputs = [ @@ -205,7 +205,7 @@ describe('Assertions', () => { 'user:password@api.example-relayer.net', '//api.example-relayer.net', ]; - invalidInputs.forEach(input => expect(assert.isHttpUrl.bind(assert, variableName, input)).to.throw()); + invalidInputs.forEach(input => expect(assert.isWebUri.bind(assert, variableName, input)).to.throw()); }); }); describe('#isUri', () => { diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts index cf0aaef0d..a221b54e8 100644 --- a/packages/connect/src/http_client.ts +++ b/packages/connect/src/http_client.ts @@ -61,7 +61,7 @@ export class HttpClient implements Client { * @return An instance of HttpClient */ constructor(url: string) { - assert.isHttpUrl('url', url); + assert.isWebUri('url', url); this._apiEndpointUrl = url.replace(TRAILING_SLASHES_REGEX, ''); // remove trailing slashes } /** diff --git a/packages/sra-report/src/index.ts b/packages/sra-report/src/index.ts index bee9db192..327c495ae 100644 --- a/packages/sra-report/src/index.ts +++ b/packages/sra-report/src/index.ts @@ -42,7 +42,7 @@ const args = yargs .argv; // perform extra validation on command line arguments try { - assert.isHttpUrl('args', args.url); + assert.isWebUri('args', args.url); } catch (err) { utils.log(`${chalk.red(`Invalid url format:`)} ${args.url}`); process.exit(1); |