diff options
author | HampusM <hampus@hampusmat.com> | 2021-07-27 16:51:54 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-07-27 16:51:54 +0200 |
commit | 055a58e79fb225978d64a3c8e3e25377cc2a5ece (patch) | |
tree | 8c37c249b93dfeb507afbf6b156955c96ad3bd49 /test/unit/repository.unit.test.ts | |
parent | fa44d81b658024685e0496150d66a51f2f5fda8c (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.ts | 33 |
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); |