forked from ubiquity/ubiquibot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands-test.ts
More file actions
70 lines (60 loc) · 1.99 KB
/
Copy pathcommands-test.ts
File metadata and controls
70 lines (60 loc) · 1.99 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { describe } from "@jest/globals";
import "dotenv/config";
import { Octokit } from "octokit";
import { Server } from "probot";
import { COMMIT_HASH } from "../commit-hash";
import { afterAllHandler } from "./after-all-handler";
import { beforeAllHandler } from "./before-all-handler";
import { testSuite } from "./test-suite";
export const TEST_TIME_LABEL = "Time: <1 Hour";
export const TEST_PRIORITY_LABEL = "Priority: 1 (Normal)";
export const SIX_HOURS = 6 * 60 * 60 * 1000; // 6 hours
// return the current 7 character git commit hash using git rev-parse
export const GIT_COMMIT_HASH = COMMIT_HASH?.substring(0, 7) ?? null;
export const owner = process.env.TEST_ORGANIZATION_NAME || "ubiquibot";
export const repo = process.env.TEST_REPOSITORY_NAME || "staging";
// generate setters and getters for the following variables
let octokitAdmin: Octokit;
let octokitCollaborator: Octokit;
let adminUsername: string | null = null;
let collaboratorUsername: string | null = null;
let server: Server;
export function getAdminUser(): Octokit {
return octokitAdmin;
}
export function setAdminUser(value: Octokit) {
octokitAdmin = value;
}
export function getCollaboratorUser(): Octokit {
return octokitCollaborator;
}
export function setCollaboratorUser(value: Octokit) {
octokitCollaborator = value;
}
export function getAdminUsername(): string | null {
return adminUsername;
}
export function setAdminUsername(value: string) {
adminUsername = value;
}
export function getCollaboratorUsername(): string | null {
return collaboratorUsername;
}
export function setCollaboratorUsername(value: string) {
collaboratorUsername = value;
}
export function getServer(): Server {
return server;
}
export function setServer(value: Server) {
server = value;
}
export const customOctokit = Octokit.defaults({
throttle: {
onRateLimit: () => true,
onSecondaryRateLimit: () => true,
},
});
beforeAll(beforeAllHandler(), SIX_HOURS);
afterAll(afterAllHandler(), SIX_HOURS);
describe("commands test", testSuite());