From df296352d46730b2e79a05506c2e416e5fce2c9d Mon Sep 17 00:00:00 2001 From: Gokulnath Reddy Date: Mon, 19 Jun 2017 22:42:54 +1000 Subject: Generate a hexaDecimal string --- test/random.unit.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/random.unit.js b/test/random.unit.js index 133fd887..d04bf280 100644 --- a/test/random.unit.js +++ b/test/random.unit.js @@ -135,4 +135,18 @@ describe("random.js", function () { assert.ok(alphaNumeric(5).length === 5); }) }) + + describe('hexaDecimal', function() { + var hexaDecimal = faker.random.hexaDecimal; + + it('should generate single hex character when no additional argument was provided', function() { + var hex = hexaDecimal(); + assert.ok(hex.match(/^(0x)[0-9a-f]{1}$/i)); + }) + + it('should generate a random hex string', function() { + var hex = hexaDecimal(5); + assert.ok(hex.match(/^(0x)[0-9a-f]+$/i)); + }) + }) }); -- cgit v1.2.3