diff options
author | HampusM <hampus@hampusmat.com> | 2021-07-07 12:24:08 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-07-07 12:24:08 +0200 |
commit | 6e7365a8c47c89eaab93c73e4a0b4ce4e69d0cb1 (patch) | |
tree | fef884af0240dad25d96008ccb0590f47d4d134f /test/unit/commit.unit.test.ts | |
parent | 1ba1c1ffd03adbee82869dae9fdc75767719b287 (diff) |
Added env variables for testing & fixed other test stuff
Diffstat (limited to 'test/unit/commit.unit.test.ts')
-rw-r--r-- | test/unit/commit.unit.test.ts | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/test/unit/commit.unit.test.ts b/test/unit/commit.unit.test.ts index c4bb6f8..b8bd178 100644 --- a/test/unit/commit.unit.test.ts +++ b/test/unit/commit.unit.test.ts @@ -1,43 +1,32 @@ - import { Repository } from "server/src/git/repository"; import { Commit } from "server/src/git/commit"; describe("Commit", () => { - const base_dir = "/home/hampus/Projects"; - let repository: Repository; beforeAll(async () => { - repository = await Repository.open(base_dir, "githermit"); + repository = await Repository.open(process.env.BASE_DIR, process.env.AVAIL_REPO); }); test("Lookup a existing commit by id", async () => { - const id = "d546492f4fd400ae61a6abbe1905fdbc67451c4d"; - - const lookupCommit = jest.fn(() => Commit.lookup(repository, id)); + const lookupCommit = jest.fn(() => Commit.lookup(repository, process.env.AVAIL_COMMIT)); const commit = await lookupCommit(); expect(lookupCommit).toReturn(); - expect(commit.id).toBe(id); + expect(commit.id).toBe(process.env.AVAIL_COMMIT); }); test("Lookup a nonexistant commit by id throws", async () => { - const id = "a546392f4fd440ae61a6afec1d25fdbc67251e2b"; - - expect(Commit.lookup(repository, id)).rejects.toThrow(); + expect(Commit.lookup(repository, process.env.UNAVAIL_COMMIT)).rejects.toThrow(); }); test("Lookup if an existing commit exists by id", async () => { - const id = "d546492f4fd400ae61a6abbe1905fdbc67451c4d"; - - expect(Commit.lookupExists(repository, id)).resolves.toBeTruthy(); + expect(Commit.lookupExists(repository, process.env.AVAIL_COMMIT)).resolves.toBeTruthy(); }); test("Lookup if an nonexistant commit exists by id", async () => { - const id = "a546392f4fd440ae61a6afec1d25fdbc67251e2b"; - - expect(Commit.lookupExists(repository, id)).resolves.toBeFalsy(); + expect(Commit.lookupExists(repository, process.env.UNAVAIL_COMMIT)).resolves.toBeFalsy(); }); describe("Functions", () => { |