added CI tests

This commit is contained in:
2016-07-04 00:00:04 +02:00
parent db27753aac
commit e0daf85e34
10 changed files with 115 additions and 27 deletions
+39 -6
View File
@@ -1,9 +1,17 @@
import "typings-test";
import beautylog = require("beautylog");
let shelljs = require("shelljs");
import path = require("path");
import "should"
import smartgit = require("../dist/index");
let 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/")
}
describe("smartgit",function(){
describe(".clone",function(){
@@ -11,7 +19,7 @@ describe("smartgit",function(){
this.timeout(20000);
smartgit.clone({
from:"git@gitlab.com:sandboxzone/sandbox-testrepo.git",
to:path.resolve("./test/temp/")
to:paths.temp
}).then(function(){
done();
});
@@ -20,19 +28,44 @@ describe("smartgit",function(){
this.timeout(20000);
smartgit.clone({
from:"https://gitlab.com/sandboxzone/sandbox-testrepo.git",
to:path.resolve("./test/temp2/")
to:paths.temp2
}).then(function(){
done();
});
});
});
describe(".check",function(){
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);
})
});
describe("commit",function(){
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");
})
});
describe("init",function(){
it("should error for noGit",function(){
smartgit.init(paths.noGit);
});
it("should init a new git",function(){
smartgit.init(paths.temp3);
})
});
describe("pull",function(){
this.timeout(10000);
it("should error for noGit",function(){
smartgit.pull(paths.noGit);
});
it("should pull from origin",function(){
smartgit.pull(paths.temp);
})
});
});