diff --git a/spec/git.spec.js b/spec/git.spec.js index 2d895370..380f8e25 100644 --- a/spec/git.spec.js +++ b/spec/git.spec.js @@ -14,12 +14,18 @@ var compareAnswer = function(headless, expectedJSON) { expect(equal).toBe(true); }; +var expectCommandToProduceTree = function(command, expectedJSON) { + var headless = new HeadlessGit(); + headless.sendCommand(command); + compareAnswer(headless, expectedJSON); +}; + describe('GitEngine', function() { it('Should commit off of head', function() { - var headless = new HeadlessGit(); - var expectedJSON = '{"branches":{"master":{"target":"C2","id":"master","type":"branch"}},"commits":{"C0":{"type":"commit","parents":[],"id":"C0","rootCommit":true},"C1":{"type":"commit","parents":["C0"],"id":"C1"},"C2":{"type":"commit","parents":["C1"],"id":"C2"}},"HEAD":{"id":"HEAD","target":"master","type":"general ref"}}'; - headless.sendCommand('git commit'); - compareAnswer(headless, expectedJSON); + expectCommandToProduceTree( + 'git commit', + '{"branches":{"master":{"target":"C2","id":"master","type":"branch"}},"commits":{"C0":{"type":"commit","parents":[],"id":"C0","rootCommit":true},"C1":{"type":"commit","parents":["C0"],"id":"C1"},"C2":{"type":"commit","parents":["C1"],"id":"C2"}},"HEAD":{"id":"HEAD","target":"master","type":"general ref"}}' + ); }); });