Skip to content

Commit e82e64f

Browse files
shdwjktarmolov
authored andcommitted
KnownOrder: Added a test to assure that the known order execution is preserved in the future. (#47)
1 parent 52c04e2 commit e82e64f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/run.test.js

+19
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,25 @@ describe('git-hook runner', function () {
9696
});
9797
});
9898

99+
describe('more than one in known order', function () {
100+
var hooks = ['03.foo', '01.bar', '02.baz'];
101+
beforeEach(function () {
102+
var logFile = SANDBOX_PATH + 'ordered.log';
103+
hooks.forEach(function (name) {
104+
createHook(PROJECT_PRECOMMIT_HOOK + name, 'echo ' + name + '>> ' + logFile);
105+
});
106+
});
107+
108+
it('should run it one by one in known order', function (done) {
109+
gitHooks.run(PRECOMMIT_HOOK_PATH, [], function (code) {
110+
code.should.equal(0);
111+
var logFile = SANDBOX_PATH + 'ordered.log';
112+
fs.readFileSync(logFile).toString().should.equal(hooks.sort().join('\n') + '\n');
113+
done();
114+
});
115+
});
116+
});
117+
99118
describe('and work without errors', function () {
100119
var logFile = SANDBOX_PATH + 'hello.log';
101120
beforeEach(function () {

0 commit comments

Comments
 (0)