Skip to content

Instantly share code, notes, and snippets.

@probil
Created April 3, 2017 08:55
Show Gist options
  • Select an option

  • Save probil/82cca5300c59e141a74aa3e12c4ff173 to your computer and use it in GitHub Desktop.

Select an option

Save probil/82cca5300c59e141a74aa3e12c4ff173 to your computer and use it in GitHub Desktop.

Revisions

  1. probil created this gist Apr 3, 2017.
    20 changes: 20 additions & 0 deletions ipv4.test.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    it('Should return true for correct ipv4', () => {
    let correctIps = [
    '0.0.0.0/0',
    '255.255.255.255/32',
    '159.12.101.0/24'
    ];

    let expected = {}
    correctIps.map(ip => {
    actual[ip] = true;
    })

    let actual = {};
    correctIps.map(ip => {
    actual[ip] = ipv4.isValid(ip);
    })


    expect(actual).toMatchObject(expected);
    })