Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "ipterate", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": " A small utility library to allow you to iterate through all IPs within a given subnet. Remains efficient no matter how many IPs there are in the range.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node ./node_modules/mocha/bin/mocha --recursive" | ||
"test": "node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha --report lcovonly -- --recursive && cat ./coverage/lcov.info | node ./node_modules/coveralls/bin/coveralls.js" | ||
}, | ||
@@ -21,4 +21,7 @@ "repository": "https://github.com/kamiljano/ipterate", | ||
"chai-spies": "~1.0.0", | ||
"mocha": "~5.0.5" | ||
"coveralls": "^3.0.0", | ||
"istanbul": "^1.1.0-alpha.1", | ||
"mocha": "~5.0.5", | ||
"mocha-lcov-reporter": "^1.3.0" | ||
} | ||
} |
@@ -0,1 +1,5 @@ | ||
[![Build Status](https://travis-ci.org/kamiljano/ipterate.svg?branch=master)](https://travis-ci.org/kamiljano/ipterate) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/kamiljano/ipterate/badge.svg?targetFile=package.json)](https://snyk.io/test/github/kamiljano/ipterate?targetFile=package.json) | ||
[![Coverage Status](https://coveralls.io/repos/github/kamiljano/ipterate/badge.svg?branch=master)](https://coveralls.io/github/kamiljano/ipterate?branch=master) | ||
# About | ||
@@ -2,0 +6,0 @@ |
@@ -25,2 +25,25 @@ 'use strict'; | ||
it('WHEN triggering the iterateAsync(), THEN all IPs within the subnet are properly processed', async () => { | ||
await new IpRange('255.255.255.0/24').iterateAsync(async ip => { | ||
callback(ip); | ||
}); | ||
expect(callback).to.have.been.called.exactly(256); | ||
expect(callback).to.have.been.called.with('255.255.255.0'); | ||
expect(callback).to.have.been.called.with('255.255.255.255'); | ||
}); | ||
}); | ||
describe('GIVEN the IpRange object is created with an invalid address', () => { | ||
it('THEN an error should be thrown', () => { | ||
let err; | ||
try { | ||
new IpRange(''); | ||
} catch(e) { | ||
err = e; | ||
} | ||
expect(err).to.not.be.undefined; | ||
}); | ||
}); |
@@ -37,5 +37,9 @@ 'use strict'; | ||
it('WHEN the string contains too high number as the IP mask, THEN an error should be thrown', () => { | ||
expectError(() => new SubnetIpV4('256.0.0.1/33')); | ||
expectError(() => new SubnetIpV4('255.0.0.1/33')); | ||
}); | ||
it('WHEN the mask is not applicable for the specified ip, THEN an error should be thrown', () => { | ||
expectError(() => new SubnetIpV4('255.0.0.1/0')); | ||
}); | ||
it('WHEN the string contains the mask does not match the IP address, THEN an error should be thrown', () => { | ||
@@ -42,0 +46,0 @@ expectError(() => new SubnetIpV4('255.255.0.0/15')); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10717
10
229
51
6