aboutsummaryrefslogtreecommitdiff
path: root/test/unit/repository.unit.test.ts
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-07-27 17:44:40 +0200
committerHampusM <hampus@hampusmat.com>2021-07-27 17:44:40 +0200
commit19f7523a4590fd41792d22d662bd6f5cf2bfead0 (patch)
tree2225d0a2f5731c24f4d2224c8abdf0544cf4785c /test/unit/repository.unit.test.ts
parent055a58e79fb225978d64a3c8e3e25377cc2a5ece (diff)
Made the unit test structure more consistent
Diffstat (limited to 'test/unit/repository.unit.test.ts')
-rw-r--r--test/unit/repository.unit.test.ts52
1 files changed, 27 insertions, 25 deletions
diff --git a/test/unit/repository.unit.test.ts b/test/unit/repository.unit.test.ts
index dfb158d..dd0d09b 100644
--- a/test/unit/repository.unit.test.ts
+++ b/test/unit/repository.unit.test.ts
@@ -18,45 +18,47 @@ function expectRepositoryProperties(repository: Repository) {
}
describe("Repository", () => {
- it("Should open a repository", async() => {
- expect.assertions(8);
+ describe("Class methods", () => {
+ it("Should open a repository", async() => {
+ expect.assertions(8);
- const repository = await Repository.open(env.BASE_DIR, env.AVAIL_REPO);
+ const repository = await Repository.open(env.BASE_DIR, env.AVAIL_REPO);
- expect(repository).toBeDefined();
- expect(repository).toBeInstanceOf(Repository);
+ expect(repository).toBeDefined();
+ expect(repository).toBeInstanceOf(Repository);
- expectRepositoryProperties(repository);
- });
+ expectRepositoryProperties(repository);
+ });
- it("Should fail to open a nonexistant repository", async() => {
- expect.assertions(1);
+ it("Should fail to open a nonexistant repository", async() => {
+ expect.assertions(1);
- await expect(Repository.open(env.BASE_DIR, env.UNAVAIL_REPO)).rejects.toBeInstanceOf(BaseError);
- });
+ 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);
+ 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);
- });
+ await expect(Repository.open(env.BASE_DIR, env.AVAIL_REPO, "wubbalubbadubdub")).rejects.toBeInstanceOf(BaseError);
+ });
- it("Should open all repositories", async() => {
- expect.hasAssertions();
+ it("Should open all repositories", async() => {
+ expect.hasAssertions();
- const all_repositories = await Repository.openAll(env.BASE_DIR);
+ const all_repositories = await Repository.openAll(env.BASE_DIR);
- expect(all_repositories).toBeDefined();
+ expect(all_repositories).toBeDefined();
- for(const repository of all_repositories) {
- expect(repository).toBeDefined();
- expect(repository).toBeInstanceOf(Repository);
+ for(const repository of all_repositories) {
+ expect(repository).toBeDefined();
+ expect(repository).toBeInstanceOf(Repository);
- expectRepositoryProperties(repository);
- }
+ expectRepositoryProperties(repository);
+ }
+ });
});
- describe("Methods", () => {
+ describe("Instance methods", () => {
let repository: Repository;
beforeAll(async() => {