2016-06-12 14:46:59 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-test");
|
2016-07-03 22:00:04 +00:00
|
|
|
var shelljs = require("shelljs");
|
2016-03-30 23:59:45 +00:00
|
|
|
var path = require("path");
|
2016-06-12 14:46:59 +00:00
|
|
|
require("should");
|
|
|
|
var smartgit = require("../dist/index");
|
2016-07-03 22:00:04 +00:00
|
|
|
var paths = {
|
|
|
|
temp: path.resolve("./test/temp/"),
|
|
|
|
temp2: path.resolve("./test/temp2/"),
|
|
|
|
temp3: path.resolve("./test/temp3"),
|
|
|
|
temp4: path.resolve("./test/temp4"),
|
|
|
|
noGit: path.resolve("./test/")
|
|
|
|
};
|
2016-03-30 23:59:45 +00:00
|
|
|
describe("smartgit", function () {
|
|
|
|
describe(".clone", function () {
|
2016-06-12 14:46:59 +00:00
|
|
|
it("should clone a repository using ssh and sshkey", function (done) {
|
2016-07-04 01:49:24 +00:00
|
|
|
this.timeout(40000);
|
2016-03-30 23:59:45 +00:00
|
|
|
smartgit.clone({
|
2016-06-25 17:13:19 +00:00
|
|
|
from: "git@gitlab.com:sandboxzone/sandbox-testrepo.git",
|
2016-07-03 22:00:04 +00:00
|
|
|
to: paths.temp
|
2016-03-30 23:59:45 +00:00
|
|
|
}).then(function () {
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2016-06-12 14:46:59 +00:00
|
|
|
it("should clone a repository using https", function (done) {
|
2016-07-04 01:49:24 +00:00
|
|
|
this.timeout(40000);
|
2016-06-12 14:46:59 +00:00
|
|
|
smartgit.clone({
|
2016-06-25 17:13:19 +00:00
|
|
|
from: "https://gitlab.com/sandboxzone/sandbox-testrepo.git",
|
2016-07-03 22:00:04 +00:00
|
|
|
to: paths.temp2
|
2016-06-12 14:46:59 +00:00
|
|
|
}).then(function () {
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2016-03-30 23:59:45 +00:00
|
|
|
});
|
2016-07-03 22:00:04 +00:00
|
|
|
describe(".add", function () {
|
|
|
|
it("should error for noGit", function () {
|
|
|
|
smartgit.add.addAll(paths.noGit);
|
|
|
|
});
|
|
|
|
it("should add a file to an existing repository", function () {
|
|
|
|
shelljs.exec("(cd " + paths.temp + " && cp ../test.js .)");
|
|
|
|
smartgit.add.addAll(paths.temp);
|
|
|
|
});
|
2016-03-30 23:59:45 +00:00
|
|
|
});
|
|
|
|
describe("commit", function () {
|
2016-07-03 22:00:04 +00:00
|
|
|
it("should error for noGit", function () {
|
|
|
|
smartgit.commit(paths.noGit, "some commit message");
|
|
|
|
});
|
|
|
|
it("should commit a new file to an existing repository", function () {
|
|
|
|
smartgit.commit(paths.temp, "added a new file");
|
|
|
|
});
|
2016-03-30 23:59:45 +00:00
|
|
|
});
|
|
|
|
describe("init", function () {
|
2016-07-03 22:00:04 +00:00
|
|
|
it("should error for noGit", function () {
|
|
|
|
smartgit.init(paths.noGit);
|
|
|
|
});
|
|
|
|
it("should init a new git", function () {
|
|
|
|
smartgit.init(paths.temp3);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe("pull", function () {
|
2016-07-04 01:49:24 +00:00
|
|
|
this.timeout(40000);
|
2016-07-03 22:00:04 +00:00
|
|
|
it("should error for noGit", function () {
|
|
|
|
smartgit.pull(paths.noGit);
|
|
|
|
});
|
|
|
|
it("should pull from origin", function () {
|
|
|
|
smartgit.pull(paths.temp);
|
|
|
|
});
|
2016-03-30 23:59:45 +00:00
|
|
|
});
|
2016-07-05 01:47:38 +00:00
|
|
|
describe("push", function () {
|
|
|
|
this.timeout(40000);
|
|
|
|
it("should error for noGit", function () {
|
|
|
|
smartgit.push(paths.noGit);
|
|
|
|
});
|
|
|
|
it("should push to origin", function () {
|
|
|
|
smartgit.push(paths.temp, "origin", "master");
|
|
|
|
});
|
|
|
|
});
|
2016-07-04 01:49:24 +00:00
|
|
|
describe("remote", function () {
|
|
|
|
it("should error for noGit", function () {
|
|
|
|
smartgit.remote.add(paths.noGit, null, null);
|
|
|
|
});
|
|
|
|
it("should error for no remote name", function () {
|
|
|
|
smartgit.remote.add(paths.temp, null, null);
|
|
|
|
});
|
|
|
|
it("should error for no remote link", function () {
|
|
|
|
smartgit.remote.add(paths.temp, "origin", null);
|
|
|
|
});
|
|
|
|
it("should add a remote", function () {
|
|
|
|
smartgit.remote.add(paths.temp, "origin2", "https://github.com/pushrocks/somerepo");
|
|
|
|
});
|
|
|
|
});
|
2016-03-30 23:59:45 +00:00
|
|
|
});
|
2016-07-05 01:47:38 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFFdEIsSUFBSSxPQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQ2pDLElBQU8sSUFBSSxXQUFXLE1BQU0sQ0FBQyxDQUFDO0FBQzlCLFFBQU8sUUFFUCxDQUFDLENBRmM7QUFFZixJQUFPLFFBQVEsV0FBVyxlQUFlLENBQUMsQ0FBQztBQUMzQyxJQUFJLEtBQUssR0FBRztJQUNSLElBQUksRUFBRSxJQUFJLENBQUMsT0FBTyxDQUFDLGNBQWMsQ0FBQztJQUNsQyxLQUFLLEVBQUUsSUFBSSxDQUFDLE9BQU8sQ0FBQyxlQUFlLENBQUM7SUFDcEMsS0FBSyxFQUFFLElBQUksQ0FBQyxPQUFPLENBQUMsY0FBYyxDQUFDO0lBQ25DLEtBQUssRUFBRSxJQUFJLENBQUMsT0FBTyxDQUFDLGNBQWMsQ0FBQztJQUNuQyxLQUFLLEVBQUUsSUFBSSxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUM7Q0FDakMsQ0FBQTtBQUVELFFBQVEsQ0FBQyxVQUFVLEVBQUM7SUFDaEIsUUFBUSxDQUFDLFFBQVEsRUFBQztRQUNkLEVB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