mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 16:08:34 +02:00
git tests coming
This commit is contained in:
parent
ddf399e099
commit
822ed2e7fa
2 changed files with 26 additions and 1 deletions
25
spec/git.spec.js
Normal file
25
spec/git.spec.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
var HeadlessGit = require('../src/js/git/headless').HeadlessGit;
|
||||
var TreeCompare = require('../src/js/git/treeCompare').TreeCompare;
|
||||
var treeCompare = new TreeCompare();
|
||||
|
||||
var loadTree = function(json) {
|
||||
return JSON.parse(unescape(json));
|
||||
};
|
||||
|
||||
var compareAnswer = function(headless, expectedJSON) {
|
||||
var expectedTree = loadTree(expectedJSON);
|
||||
var actualTree = headless.gitEngine.exportTree()
|
||||
|
||||
var equal = treeCompare.compareTrees(expectedTree, actualTree);
|
||||
expect(equal).toBe(true);
|
||||
};
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
2
todo.txt
2
todo.txt
|
@ -8,7 +8,6 @@ Big Graphic things:
|
|||
Medium things:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
[ ] gitEngine loads from tree immediately, not the weird thing we have now!
|
||||
[.] headless Git for testing (send it commands and expected trees)
|
||||
[.] few tests
|
||||
|
||||
Small things to implement:
|
||||
|
@ -30,4 +29,5 @@ Done things:
|
|||
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
[x] aliases replace when put into commands
|
||||
[x] headless Git for testing (send it commands and expected trees)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue