From 93a4a8bf924588cd866714b86ec8f16f8d51dec0 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 29 Jul 2021 17:10:54 +0200 Subject: Organized tsconfigs, fixed tests and improved some backend functions --- test/int/api.int.test.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'test/int/api.int.test.ts') diff --git a/test/int/api.int.test.ts b/test/int/api.int.test.ts index b93a947..11478ad 100644 --- a/test/int/api.int.test.ts +++ b/test/int/api.int.test.ts @@ -265,7 +265,15 @@ describe("API", () => { beforeAll(async() => { const body = new Readable({ read: () => null }); - const head = /^[a-f0-9]+/.exec((await readFile(`${env.BASE_DIR}/${env.AVAIL_REPO}/FETCH_HEAD`)).toString())[0]; + let head = (await readFile(`${env.BASE_DIR}/${env.AVAIL_REPO}/FETCH_HEAD`)).toString(); + + const find_head = /^[a-f0-9]+/.exec(head); + + if(!find_head) { + throw(new Error("Failed to get repository head!")); + } + + head = find_head[0]; body.push(`0098want ${head} multi_ack_detailed no-done side-band-64k thin-pack ofs-delta deepen-since deepen-not agent=git/2.32.0\n00000009done\n`); body.push(null); -- cgit v1.2.3-18-g5258