add another test for checkout
This commit is contained in:
parent
d937a3c552
commit
f8f0454f33
|
@ -33,6 +33,7 @@ describe('when parsing a gitGraph',function() {
|
|||
expect(parser.yy.getDirection()).toBe("TB");
|
||||
expect(Object.keys(parser.yy.getBranches()).length).toBe(1);
|
||||
});
|
||||
|
||||
it('should checkout a branch', function () {
|
||||
var str = 'gitGraph:\n' +
|
||||
'branch new\n' +
|
||||
|
@ -45,6 +46,22 @@ describe('when parsing a gitGraph',function() {
|
|||
expect(parser.yy.getCurrentBranch()).toBe("new");
|
||||
});
|
||||
|
||||
it('should add commits to checked out branch', function () {
|
||||
var str = 'gitGraph:\n' +
|
||||
'branch new\n' +
|
||||
'checkout new\n' +
|
||||
'commit\n'+
|
||||
'commit\n'
|
||||
|
||||
parser.parse(str);
|
||||
var commits = parser.yy.getCommits();
|
||||
|
||||
expect(Object.keys(commits).length).toBe(2);
|
||||
expect(parser.yy.getCurrentBranch()).toBe("new");
|
||||
var branchCommit = parser.yy.getBranches()['new'];
|
||||
expect(branchCommit).not.toBeNull();
|
||||
expect(commits[branchCommit].parent).not.toBeNull();
|
||||
});
|
||||
it('should handle commit with args', function () {
|
||||
var str = 'gitGraph:\n' +
|
||||
'commit "a commit"\n';
|
||||
|
|
Loading…
Reference in New Issue