aboutsummaryrefslogtreecommitdiff
path: root/test/git.unit.js
diff options
context:
space:
mode:
authorDanielle Adams <[email protected]>2018-06-27 20:31:44 -0400
committerMarak <[email protected]>2018-09-23 11:12:09 -0400
commit200ab1321231e63be401917433cd651ba2df7c51 (patch)
tree9fbcd37eb77dbee6f8ec4f21403f906bae20800e /test/git.unit.js
parentc29b9407064dbc14baa338f2ba9713d49b99e1dd (diff)
downloadfaker-200ab1321231e63be401917433cd651ba2df7c51.tar.xz
faker-200ab1321231e63be401917433cd651ba2df7c51.zip
add commit entry and remove readme changes
Diffstat (limited to 'test/git.unit.js')
-rw-r--r--test/git.unit.js71
1 files changed, 67 insertions, 4 deletions
diff --git a/test/git.unit.js b/test/git.unit.js
index 38177a18..d32950c5 100644
--- a/test/git.unit.js
+++ b/test/git.unit.js
@@ -24,10 +24,65 @@ 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}$/));
+ describe("commitEntry()", function() {
+ beforeEach(function() {
+ sinon.spy(faker.git, 'commitMessage');
+ sinon.spy(faker.git, 'commitSha');
+ sinon.spy(faker.internet, 'email');
+ sinon.spy(faker.name, 'firstName');
+ sinon.spy(faker.name, 'lastName');
+ sinon.spy(faker.random, 'number');
+ });
+
+ afterEach(function() {
+ faker.git.commitMessage.restore();
+ faker.git.commitSha.restore();
+ faker.internet.email.restore();
+ faker.name.firstName.restore();
+ faker.name.lastName.restore();
+ faker.random.number.restore();
+ });
+
+ it("returns merge entry at random", function() {
+ faker.git.commitEntry();
+
+ assert.ok(faker.random.number.called);
+ });
+
+ it("returns a commit entry with git commit message and sha", function() {
+ faker.git.commitEntry();
+
+ assert.ok(faker.git.commitMessage.calledOnce);
+ assert.ok(faker.git.commitSha.calledOnce);
+ });
+
+ it("returns a commit entry with internet email", function() {
+ faker.git.commitEntry();
+
+ assert.ok(faker.internet.email.calledOnce);
+ });
+
+ it("returns a commit entry with name first and last", function() {
+ faker.git.commitEntry();
+
+ assert.ok(faker.name.firstName.calledTwice);
+ assert.ok(faker.name.lastName.calledTwice);
+ });
+
+ context("with options['merge'] equal to true", function() {
+ beforeEach(function() {
+ sinon.spy(faker.git, 'shortSha');
+ });
+
+ afterEach(function() {
+ faker.git.shortSha.restore();
+ });
+
+ it("returns a commit entry with merge details", function() {
+ faker.git.commitEntry({ merge: true });
+
+ assert.ok(faker.git.shortSha.calledTwice);
+ });
});
});
@@ -53,6 +108,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}$/));
+ });
+ });
+
describe("shortSha()", function() {
it("returns a random short SHA", function() {
var shortSha = faker.git.shortSha();