mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 17:00:04 +02:00
WIP have half of hg commands mapped
This commit is contained in:
parent
51e1cc2b77
commit
a033173281
10 changed files with 817 additions and 27 deletions
55
spec/vcs.spec.js
Normal file
55
spec/vcs.spec.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
var _ = require('underscore');
|
||||
|
||||
var Command = require('../src/js/models/commandModel').Command;
|
||||
|
||||
describe('commands', function() {
|
||||
it('replaces . with HEAD correctly', function() {
|
||||
var testCases = {
|
||||
'.^': 'HEAD^',
|
||||
'.': 'HEAD',
|
||||
'.~4': 'HEAD~4'
|
||||
};
|
||||
|
||||
var c = new Command({rawStr: 'foo'});
|
||||
_.each(testCases, function(expected, input) {
|
||||
var actual = c.replaceDotWithHead(input);
|
||||
expect(actual).toBe(expected);
|
||||
});
|
||||
});
|
||||
|
||||
it('maps options and general args', function() {
|
||||
var testCases = [{
|
||||
args: ['.~4', 'HEAD^'],
|
||||
options: {
|
||||
'--amend': ['.'],
|
||||
'-m': ['"oh hai"']
|
||||
},
|
||||
gitArgs: ['HEAD~4', 'HEAD^'],
|
||||
gitOptions: {
|
||||
'--amend': ['HEAD'],
|
||||
'-m': ['"oh hai"']
|
||||
}
|
||||
}];
|
||||
|
||||
var c = new Command({rawStr: 'foo'});
|
||||
_.each(testCases, function(tCase) {
|
||||
c.setSupportedMap(tCase.options);
|
||||
c.setGeneralArgs(tCase.args);
|
||||
c.mapDotToHead();
|
||||
|
||||
var j = JSON.stringify;
|
||||
expect(
|
||||
j(c.getGeneralArgs())
|
||||
).toBe(
|
||||
j(tCase.gitArgs)
|
||||
);
|
||||
|
||||
expect(
|
||||
j(c.getSupportedMap())
|
||||
).toBe(
|
||||
j(tCase.gitOptions)
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue