Skip to content

Commit 1096f80

Browse files
author
Ognjen Jevremovic
committed
test(tests/staging.js): preserve the functionality of the --all flag
Extend upon the existing staging unit tests. Assert that the files are added to staging area when running commitizen commit command with -a (--all) flag, prior to spawning the prompt. "re commitizen#785"
1 parent cce3176 commit 1096f80

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

test/tests/staging.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,43 @@ describe('staging', function () {
7878
});
7979
});
8080

81+
it('should determine if --all flag adds files to staging area', function (done) {
82+
83+
this.timeout(config.maxTimeout); // this could take a while
84+
85+
// SETUP
86+
87+
// Describe a repo and some files to add and commit
88+
let repoConfig = {
89+
path: config.paths.endUserRepo,
90+
files: {
91+
dummyfile: {
92+
contents: `duck-duck-gray-duck`,
93+
filename: `mydummiestfile.txt`,
94+
},
95+
gitignore: {
96+
contents: `node_modules/`,
97+
filename: `.gitignore`
98+
}
99+
}
100+
};
101+
102+
gitInit(repoConfig.path);
103+
104+
staging.isClean(repoConfig.path, function (stagingIsCleanError, stagingIsClean) {
105+
expect(stagingIsCleanError).to.be.null;
106+
expect(stagingIsClean).to.be.true;
107+
108+
writeFilesToPath(repoConfig.files, repoConfig.path);
109+
110+
staging.isClean(repoConfig.path, function (afterWriteStagingIsCleanError, afterWriteStagingIsClean) {
111+
expect(afterWriteStagingIsCleanError).to.be.null;
112+
expect(afterWriteStagingIsClean).to.be.true;
113+
114+
done();
115+
});
116+
}, true);
117+
});
81118
});
82119

83120
afterEach(function () {

0 commit comments

Comments
 (0)