Skip to content

Commit

Permalink
test(tests/staging.js): preserve the functionality of the --all flag
Browse files Browse the repository at this point in the history
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"
  • Loading branch information
Ognjen Jevremovic committed Mar 26, 2021
1 parent cce3176 commit 1096f80
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/tests/staging.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,43 @@ describe('staging', function () {
});
});

it('should determine if --all flag adds files to staging area', function (done) {

this.timeout(config.maxTimeout); // this could take a while

// SETUP

// Describe a repo and some files to add and commit
let repoConfig = {
path: config.paths.endUserRepo,
files: {
dummyfile: {
contents: `duck-duck-gray-duck`,
filename: `mydummiestfile.txt`,
},
gitignore: {
contents: `node_modules/`,
filename: `.gitignore`
}
}
};

gitInit(repoConfig.path);

staging.isClean(repoConfig.path, function (stagingIsCleanError, stagingIsClean) {
expect(stagingIsCleanError).to.be.null;
expect(stagingIsClean).to.be.true;

writeFilesToPath(repoConfig.files, repoConfig.path);

staging.isClean(repoConfig.path, function (afterWriteStagingIsCleanError, afterWriteStagingIsClean) {
expect(afterWriteStagingIsCleanError).to.be.null;
expect(afterWriteStagingIsClean).to.be.true;

done();
});
}, true);
});
});

afterEach(function () {
Expand Down

0 comments on commit 1096f80

Please sign in to comment.