IpMatcherRange.test.mjs 624 B

12345678910111213141516171819
  1. import { convertCidrRanges } from '../../../../scripts/ip_matcher_ranges.mjs'
  2. describe('IpMatcherRange', function () {
  3. it('returns IP ranges from CIDR notation', function () {
  4. const ranges = convertCidrRanges(['192.168.1.0/24'])
  5. expect(ranges).to.deep.equal('192.168.1.0..192.168.1.255')
  6. })
  7. it('returns IP ranges from a variation CIDR notation', function () {
  8. const ranges = convertCidrRanges([
  9. '192.168.0.0/24',
  10. '10.0.0.0/8',
  11. '172.16.0.0/12',
  12. ])
  13. expect(ranges).to.deep.equal(
  14. '192.168.0.0..192.168.0.255,10.0.0.0..10.255.255.255,172.16.0.0..172.31.255.255'
  15. )
  16. })
  17. })