From 19f7523a4590fd41792d22d662bd6f5cf2bfead0 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 27 Jul 2021 17:44:40 +0200 Subject: Made the unit test structure more consistent --- test/unit/commit.unit.test.ts | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'test/unit/commit.unit.test.ts') diff --git a/test/unit/commit.unit.test.ts b/test/unit/commit.unit.test.ts index 2a43855..abbdb9a 100644 --- a/test/unit/commit.unit.test.ts +++ b/test/unit/commit.unit.test.ts @@ -13,36 +13,38 @@ describe("Commit", () => { repository = await Repository.open(env.BASE_DIR, env.AVAIL_REPO); }); - it("Should look up a commit", async() => { - expect.assertions(8); + describe("Class methods", () => { + it("Should look up a commit", async() => { + expect.assertions(8); - const commit = await Commit.lookup(repository, env.AVAIL_COMMIT); + const commit = await Commit.lookup(repository, env.AVAIL_COMMIT); - expect(commit).toBeDefined(); - expect(commit).toBeInstanceOf(Commit); + expect(commit).toBeDefined(); + expect(commit).toBeInstanceOf(Commit); - expectCommitProperties(commit); - }); + expectCommitProperties(commit); + }); - it("Should look up a nonexistant commit and throw", async() => { - expect.assertions(1); + it("Should look up a nonexistant commit and throw", async() => { + expect.assertions(1); - await expect(Commit.lookup(repository, env.UNAVAIL_COMMIT)).rejects.toThrow(); - }); + await expect(Commit.lookup(repository, env.UNAVAIL_COMMIT)).rejects.toThrow(); + }); - it("Should look up if an existent commit exists and respond true", async() => { - expect.assertions(1); + it("Should look up if an existent commit exists and respond true", async() => { + expect.assertions(1); - await expect(Commit.lookupExists(repository, env.AVAIL_COMMIT)).resolves.toBeTruthy(); - }); + await expect(Commit.lookupExists(repository, env.AVAIL_COMMIT)).resolves.toBeTruthy(); + }); - it("Should look up if an nonexistant commit exists and respond false", async() => { - expect.assertions(1); + it("Should look up if an nonexistant commit exists and respond false", async() => { + expect.assertions(1); - await expect(Commit.lookupExists(repository, env.UNAVAIL_COMMIT)).resolves.toBeFalsy(); + await expect(Commit.lookupExists(repository, env.UNAVAIL_COMMIT)).resolves.toBeFalsy(); + }); }); - describe("Methods", () => { + describe("Instance methods", () => { let commit: Commit; beforeAll(async() => { -- cgit v1.2.3-18-g5258