mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 07:58:34 +02:00
sweet, got unit tests in a digestable format
This commit is contained in:
parent
620b438c5b
commit
df7e636aa7
1 changed files with 10 additions and 4 deletions
|
@ -14,12 +14,18 @@ var compareAnswer = function(headless, expectedJSON) {
|
||||||
expect(equal).toBe(true);
|
expect(equal).toBe(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var expectCommandToProduceTree = function(command, expectedJSON) {
|
||||||
|
var headless = new HeadlessGit();
|
||||||
|
headless.sendCommand(command);
|
||||||
|
compareAnswer(headless, expectedJSON);
|
||||||
|
};
|
||||||
|
|
||||||
describe('GitEngine', function() {
|
describe('GitEngine', function() {
|
||||||
it('Should commit off of head', 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');
|
expectCommandToProduceTree(
|
||||||
compareAnswer(headless, expectedJSON);
|
'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"}}'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue