diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/unit/commit.unit.test.ts | 40 | ||||
| -rw-r--r-- | test/util.ts | 9 | 
2 files changed, 46 insertions, 3 deletions
| diff --git a/test/unit/commit.unit.test.ts b/test/unit/commit.unit.test.ts index 137c64c..c8cc06f 100644 --- a/test/unit/commit.unit.test.ts +++ b/test/unit/commit.unit.test.ts @@ -80,5 +80,45 @@ describe("Commit", () => {  			expect(tree).toBeDefined();  			expect(tree).toBeInstanceOf(Tree);  		}); + +		it("Should get if it's signed and respond true", async() => { +			expect.assertions(2); + +			const is_signed = await commit.isSigned(); + +			expect(is_signed).toBeDefined(); +			expect(is_signed).toBeTruthy(); +		}); + +		it("Should get if a unsigned commit is signed and respond false", async() => { +			expect.assertions(2); + +			const other_commit = await Commit.lookup(repository, "7578c24113ba71d7435a94c649566e4e39e0e88c"); + +			const is_signed = await other_commit.isSigned(); + +			expect(is_signed).toBeDefined(); +			expect(is_signed).toBeFalsy(); +		}); + +		it("Should get the author", async() => { +			expect.assertions(7); + +			const author = await commit.author(); + +			expect(author).toBeDefined(); + +			expect(author).toHaveProperty("name"); +			expect(author.name).toBeDefined(); + +			expect(author).toHaveProperty("email"); +			expect(author.email).toBeDefined(); + +			expect(author).toHaveProperty("fingerprint"); + +			const fingerprint = await author.fingerprint(); + +			expect(fingerprint).toBeDefined(); +		});  	});  });
\ No newline at end of file diff --git a/test/util.ts b/test/util.ts index 5886514..0079580 100644 --- a/test/util.ts +++ b/test/util.ts @@ -1,4 +1,4 @@ -import { Commit } from "server/src/git/commit"; +import { Commit, CommitAuthor } from "server/src/git/commit";  export type EnvironmentVariables = {  	BASE_DIR: string, @@ -14,8 +14,11 @@ export type EnvironmentVariables = {  export function expectCommitProperties(commit: Commit): void {  	expect(commit).toHaveProperty("id");  	expect(commit).toHaveProperty("author"); -	expect(commit).toHaveProperty("author.name"); -	expect(commit).toHaveProperty("author.email"); + +	const author = commit.author(); +	expect(author).toBeInstanceOf(CommitAuthor); +  	expect(commit).toHaveProperty("date");  	expect(commit).toHaveProperty("message"); +	expect(commit).toHaveProperty("isSigned");  }
\ No newline at end of file | 
