mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 08:50:06 +02:00
switch specs
This commit is contained in:
parent
7bbc81de97
commit
1bd2f5de64
2 changed files with 31 additions and 20 deletions
|
@ -4,28 +4,38 @@ var HeadlessGit = require('../src/js/git/headless').HeadlessGit;
|
|||
var fs = require('fs');
|
||||
prompt = require('prompt');
|
||||
|
||||
function getFile(truthy) {
|
||||
var filename = (truthy) ?
|
||||
'./remote.spec.js' :
|
||||
'./git.spec.js';
|
||||
return fs.readFileSync(filename, 'utf8');
|
||||
}
|
||||
|
||||
prompt.start();
|
||||
|
||||
prompt.get(['command', 'whatItDoes'], function(err, result) {
|
||||
var headless = new HeadlessGit();
|
||||
headless.sendCommand(result.command);
|
||||
setTimeout(function() {
|
||||
var testCase = '\t\texpectTreeAsync(\n' +
|
||||
"\t\t\t'" + result.command + "',\n" +
|
||||
"\t\t\t'" + headless.gitEngine.printTree() + "'\n" +
|
||||
"\t\t);\n";
|
||||
prompt.get(
|
||||
['command', 'whatItDoes', 'intoGitSpec'],
|
||||
function(err, result) {
|
||||
var headless = new HeadlessGit();
|
||||
headless.sendCommand(result.command);
|
||||
setTimeout(function() {
|
||||
var testCase = '\t\texpectTreeAsync(\n' +
|
||||
"\t\t\t'" + result.command + "',\n" +
|
||||
"\t\t\t'" + headless.gitEngine.printTree() + "'\n" +
|
||||
"\t\t);\n";
|
||||
|
||||
console.log(testCase);
|
||||
// now add it
|
||||
var testFile = fs.readFileSync('./remote.spec.js', 'utf8');
|
||||
// insert after the last })
|
||||
var toSlice = testFile.lastIndexOf('})');
|
||||
var partOne = testFile.slice(0, toSlice);
|
||||
var partTwo = testFile.slice(toSlice);
|
||||
console.log(testCase);
|
||||
// now add it
|
||||
var testFile = getFile(result.intoGitSpec);
|
||||
// insert after the last })
|
||||
var toSlice = testFile.lastIndexOf('})');
|
||||
var partOne = testFile.slice(0, toSlice);
|
||||
var partTwo = testFile.slice(toSlice);
|
||||
|
||||
var funcCall = "\tit('" + result.whatItDoes + "', function() {\n" +
|
||||
testCase + "\t});\n\n";
|
||||
fs.writeFileSync('./remote.spec.js', partOne + funcCall + partTwo);
|
||||
}, 100);
|
||||
});
|
||||
var funcCall = "\tit('" + result.whatItDoes + "', function() {\n" +
|
||||
testCase + "\t});\n\n";
|
||||
fs.writeFileSync('./remote.spec.js', partOne + funcCall + partTwo);
|
||||
}, 100);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue