diff options
| author | Marak <[email protected]> | 2017-03-02 15:19:16 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-03-02 15:19:16 -0500 |
| commit | 6cdb93efcbcaf222ac061cee5532374f72ea073e (patch) | |
| tree | a4f23c1114abc37c406ea3203a2e28bfc9e050e2 /test | |
| parent | 8c43fe8f7cf81b60fc77be5510228ec8bd38f9d3 (diff) | |
| parent | 5cf0d78de1c28a9a5cd0217696ca297ff1e126df (diff) | |
| download | faker-6cdb93efcbcaf222ac061cee5532374f72ea073e.tar.xz faker-6cdb93efcbcaf222ac061cee5532374f72ea073e.zip | |
Merge pull request #408 from paolo-tanium/allow-mac-to-specify-separator
[api] Allow user to specify separator to be used in mac address
Diffstat (limited to 'test')
| -rw-r--r-- | test/internet.unit.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/internet.unit.js b/test/internet.unit.js index 12da8eec..0c9bbd30 100644 --- a/test/internet.unit.js +++ b/test/internet.unit.js @@ -173,5 +173,23 @@ describe("internet.js", function () { var mac = faker.internet.mac(); assert.ok(mac.match(/^([a-f0-9]{2}:){5}[a-f0-9]{2}$/)); }); + + it("uses the dash separator if we pass it in as our separator", function () { + var mac = faker.internet.mac('-'); + assert.ok(mac.match(/^([a-f0-9]{2}-){5}[a-f0-9]{2}$/)); + }); + + it("uses no separator if we pass in an empty string", function() { + var mac = faker.internet.mac(''); + assert.ok(mac.match(/^[a-f0-9]{12}$/)); + }); + + it("uses the default colon (:) if we provide an unacceptable separator", function() { + var mac = faker.internet.mac('!'); + assert.ok(mac.match(/^([a-f0-9]{2}:){5}[a-f0-9]{2}$/)); + + mac = faker.internet.mac('&'); + assert.ok(mac.match(/^([a-f0-9]{2}:){5}[a-f0-9]{2}$/)); + }); }); }); |
