diff options
| author | Danielle Adams <[email protected]> | 2018-07-02 21:02:58 -0400 |
|---|---|---|
| committer | Marak <[email protected]> | 2018-09-23 11:12:09 -0400 |
| commit | 49f0cea3b9b609ca643fa0e4e98f09076ad004c2 (patch) | |
| tree | e1736c3da4048e2609ba9d1fc5ce9d432fad2d46 | |
| parent | 200ab1321231e63be401917433cd651ba2df7c51 (diff) | |
| download | faker-49f0cea3b9b609ca643fa0e4e98f09076ad004c2.tar.xz faker-49f0cea3b9b609ca643fa0e4e98f09076ad004c2.zip | |
change shas to use hex chars
| -rw-r--r-- | lib/git.js | 6 | ||||
| -rw-r--r-- | test/git.unit.js | 4 |
2 files changed, 6 insertions, 4 deletions
@@ -6,6 +6,8 @@ var Git = function(faker) { var self = this; var f = faker.fake; + var hexChars = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]; + /** * branch * @@ -58,7 +60,7 @@ var Git = function(faker) { var commit = ""; for (var i = 0; i < 40; i++) { - commit += faker.random.alphaNumeric(); + commit += faker.random.arrayElement(hexChars); } return commit; @@ -73,7 +75,7 @@ var Git = function(faker) { var shortSha = ""; for (var i = 0; i < 7; i++) { - shortSha += faker.random.alphaNumeric(); + shortSha += faker.random.arrayElement(hexChars); } return shortSha; diff --git a/test/git.unit.js b/test/git.unit.js index d32950c5..df86be0b 100644 --- a/test/git.unit.js +++ b/test/git.unit.js @@ -112,14 +112,14 @@ describe("git.js", function() { describe("commitSha()", function() { it("returns a random commit SHA", function() { var commitSha = faker.git.commitSha(); - assert.ok(commitSha.match(/^[a-z0-9]{40}$/)); + assert.ok(commitSha.match(/^[a-f0-9]{40}$/)); }); }); describe("shortSha()", function() { it("returns a random short SHA", function() { var shortSha = faker.git.shortSha(); - assert.ok(shortSha.match(/^[a-z0-9]{7}$/)); + assert.ok(shortSha.match(/^[a-f0-9]{7}$/)); }); }); }); |
