-
Notifications
You must be signed in to change notification settings - Fork 0
/
git_test.ts
36 lines (29 loc) · 1.04 KB
/
git_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import {
assert,
assertEquals,
} from "https://deno.land/std@0.146.0/testing/asserts.ts";
import { info } from "https://deno.land/std@0.146.0/log/mod.ts";
import { getBranch, getCommit, getRepository, getTag } from "./git.ts";
const testErrorHandler = (message: string, error?: Error) => {
info(message);
info(error);
};
Deno.test("git", async (t) => {
const testingPath = Deno.cwd();
await t.step("gets the repository url", async () => {
const url = await getRepository(testingPath, testErrorHandler);
assertEquals(url, "git@code.eutychia.org:kay/readme-manager.git");
});
await t.step("gets the repository branch", async () => {
const branch = await getBranch(testingPath, testErrorHandler);
assertEquals(branch, "main");
});
await t.step("gets the repository commit", async () => {
const commit = await getCommit(testingPath, testErrorHandler);
assert(commit);
});
await t.step("gets the repository tag", async () => {
const tag = await getTag(testingPath, testErrorHandler);
assert(tag);
});
});