aboutsummaryrefslogtreecommitdiff
path: root/test/util.ts
blob: 30a5c6066614e117e5d61751752a82ab487a6203 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { Commit, CommitAuthor } from "server/src/git/commit";

export type EnvironmentVariables = {
	GIT_DIR: string,
	AVAIL_REPO: string,
	AVAIL_REPO_URL: string,
	UNAVAIL_REPO: string,
	AVAIL_OBJECT: string,
	UNAVAIL_OBJECT: string,
	AVAIL_COMMIT: string,
	UNAVAIL_COMMIT: string
}

export function expectCommitProperties(commit: Commit): void {
	expect(commit).toHaveProperty("id");
	expect(commit).toHaveProperty("author");

	const author = commit.author();
	expect(author).toBeInstanceOf(CommitAuthor);

	expect(commit).toHaveProperty("date");
	expect(commit).toHaveProperty("message");
	expect(commit).toHaveProperty("isSigned");
}