sharegit
Version:
Share project to remote git repo.
48 lines (40 loc) • 1.01 kB
JavaScript
/**
* Test case for sharegit.
* Runs with nodeunit.
*/
var sharegit = require('../lib/sharegit.js'),
injectmock = require('injectmock'),
childProcess = require('child_process');
exports.setUp = function (done) {
injectmock(childProcess, 'spawn', function mockSpawn() {
return {
stdout: {
pipe: function () {
}
},
stderr: {
pipe: function () {
}
},
on: function (event, callback) {
setTimeout(function () {
callback(0);
}, 2);
}
}
});
injectmock(childProcess, 'exec', function mockExec(comand, callback) {
callback(null, null);
});
done();
};
exports.tearDown = function (done) {
injectmock.restoreAll();
done();
};
exports['Do share git.'] = function (test) {
sharegit({}, function (err) {
test.ifError(err);
test.done();
});
};