sweet, got unit tests in a digestable format

This commit is contained in:
Peter Cottle 2012-12-17 21:01:50 -08:00
parent 620b438c5b
commit df7e636aa7

View file

@ -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"}}'
);
});
});