aboutsummaryrefslogtreecommitdiff
path: root/test/unit/repository.unit.test.ts
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-07-27 16:51:54 +0200
committerHampusM <hampus@hampusmat.com>2021-07-27 16:51:54 +0200
commit055a58e79fb225978d64a3c8e3e25377cc2a5ece (patch)
tree8c37c249b93dfeb507afbf6b156955c96ad3bd49 /test/unit/repository.unit.test.ts
parentfa44d81b658024685e0496150d66a51f2f5fda8c (diff)
Added new unit tests & the test setup script uses Nodegit instead of exec
Diffstat (limited to 'test/unit/repository.unit.test.ts')
-rw-r--r--test/unit/repository.unit.test.ts33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/unit/repository.unit.test.ts b/test/unit/repository.unit.test.ts
index 7d3f954..dfb158d 100644
--- a/test/unit/repository.unit.test.ts
+++ b/test/unit/repository.unit.test.ts
@@ -35,6 +35,12 @@ describe("Repository", () => {
await expect(Repository.open(env.BASE_DIR, env.UNAVAIL_REPO)).rejects.toBeInstanceOf(BaseError);
});
+ it("Should fail to open a repository with a nonexistant branch", async() => {
+ expect.assertions(1);
+
+ await expect(Repository.open(env.BASE_DIR, env.AVAIL_REPO, "wubbalubbadubdub")).rejects.toBeInstanceOf(BaseError);
+ });
+
it("Should open all repositories", async() => {
expect.hasAssertions();
@@ -57,6 +63,33 @@ describe("Repository", () => {
repository = await Repository.open(env.BASE_DIR, env.AVAIL_REPO);
});
+ it("Should get the description", async() => {
+ expect.assertions(2);
+
+ const description = await repository.description();
+
+ expect(description).toBeDefined();
+ expect(description.length).toBeGreaterThan(1);
+ });
+
+ it("Should get the owner", async() => {
+ expect.assertions(2);
+
+ const owner = await repository.owner();
+
+ expect(owner).toBeDefined();
+ expect(owner).toEqual("Bob");
+ });
+
+ it("Should get the branch", async() => {
+ expect.assertions(2);
+
+ const branch = await repository.branch();
+
+ expect(branch).toBeDefined();
+ expect(branch).toBeInstanceOf(Branch);
+ });
+
it("Should look up if an existent object exists and respond true", async() => {
expect.assertions(1);