From 6e7365a8c47c89eaab93c73e4a0b4ce4e69d0cb1 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 7 Jul 2021 12:24:08 +0200 Subject: Added env variables for testing & fixed other test stuff --- test/unit/repository.unit.test.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'test/unit/repository.unit.test.ts') diff --git a/test/unit/repository.unit.test.ts b/test/unit/repository.unit.test.ts index 0e13a2a..2a68a29 100644 --- a/test/unit/repository.unit.test.ts +++ b/test/unit/repository.unit.test.ts @@ -1,10 +1,8 @@ import { Repository } from "server/src/git/repository"; describe("Repository", () => { - const base_dir = "/home/hampus/Projects"; - test("Open existing repository", async () => { - const openRepository = jest.fn(() => Repository.open(base_dir, "githermit")); + const openRepository = jest.fn(() => Repository.open(process.env.BASE_DIR, process.env.AVAIL_REPO)); await openRepository(); @@ -12,11 +10,11 @@ describe("Repository", () => { }); test("Open nonexistant repository throws", async () => { - expect(Repository.open(base_dir, "angular")).rejects.toThrow(); + expect(Repository.open(process.env.BASE_DIR, process.env.UNAVAIL_REPO)).rejects.toThrow(); }); test("Open all repositories", async () => { - const openAllRepositories = jest.fn(() => Repository.openAll(base_dir)); + const openAllRepositories = jest.fn(() => Repository.openAll(process.env.BASE_DIR)); await openAllRepositories(); @@ -27,17 +25,17 @@ describe("Repository", () => { 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 if an existing object exists", async () => { - const exists = await repository.lookupExists("16778756fb25808a1311403590cd7d36fbbeee6c"); + const exists = await repository.lookupExists(process.env.AVAIL_OBJECT); expect(exists).toBeTruthy(); }); test("Lookup if an nonexistant object exists", async () => { - const exists = await repository.lookupExists("601747563bff808a1d12403690cd7d36fbbeafcc"); + const exists = await repository.lookupExists(process.env.UNAVAIL_OBJECT); expect(exists).toBeFalsy(); }); -- cgit v1.2.3-18-g5258