@goodfellow-cms/gitlab 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.d.ts +49 -2
- package/dist/index.js +778 -7
- package/dist/testing.d.ts +100 -1
- package/dist/testing.js +528 -10
- package/package.json +5 -5
package/dist/testing.d.ts
CHANGED
|
@@ -21,11 +21,110 @@ export interface FakeGitLabOptions {
|
|
|
21
21
|
};
|
|
22
22
|
/** Simulates a GitLab Pages pipeline that succeeds after being checked this many times. Off by default. */
|
|
23
23
|
deployAfterChecks?: number;
|
|
24
|
+
/** Groups the users belong to, which new projects can be created in. */
|
|
25
|
+
groups?: string[];
|
|
26
|
+
/** Publishes the site with GitLab Pages. Off by default. */
|
|
27
|
+
pages?: {
|
|
28
|
+
uniqueDomain?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/** Other GitLab accounts that exist, which can be added to the project. Every token's user exists and is a member. */
|
|
31
|
+
accounts?: string[];
|
|
32
|
+
}
|
|
33
|
+
/** A member of the site's project. */
|
|
34
|
+
export interface FakeMember {
|
|
35
|
+
id: number;
|
|
36
|
+
username: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
accessLevel: number;
|
|
39
|
+
/** A member through a group rather than the project itself. */
|
|
40
|
+
inherited?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** A custom domain added to the site's GitLab Pages. */
|
|
43
|
+
export interface FakePagesDomain {
|
|
44
|
+
verified: boolean;
|
|
45
|
+
verificationCode: string;
|
|
46
|
+
/** Whether Let's Encrypt has issued the certificate. */
|
|
47
|
+
certificate: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** The site's GitLab Pages settings, which tests can change. */
|
|
50
|
+
export interface FakeGitLabPages {
|
|
51
|
+
uniqueDomain: boolean;
|
|
52
|
+
forceHttps: boolean;
|
|
53
|
+
primaryDomain: string | null;
|
|
54
|
+
domains: Map<string, FakePagesDomain>;
|
|
55
|
+
/** Domains whose TXT record GitLab would find, so verifying them works. */
|
|
56
|
+
dnsReady: Set<string>;
|
|
57
|
+
}
|
|
58
|
+
/** A project created through the fake's API, as the setup page creates them. */
|
|
59
|
+
export interface FakeCreatedProject {
|
|
60
|
+
id: number;
|
|
61
|
+
path: string;
|
|
62
|
+
visibility: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
pagesAccessLevel?: string;
|
|
65
|
+
repo: FakeRepo;
|
|
24
66
|
}
|
|
25
67
|
export declare function fakeGitLab(options: FakeGitLabOptions): {
|
|
68
|
+
/** How many GraphQL requests read files, as `readFiles()` makes. */
|
|
69
|
+
readonly graphqlReads: number;
|
|
70
|
+
/** The project's members by user id, invitations by email, and protected branches, which tests can change. */
|
|
71
|
+
members: Map<number, FakeMember>;
|
|
72
|
+
invitations: Map<string, number>;
|
|
73
|
+
protectedBranches: Map<string, {
|
|
74
|
+
push: number;
|
|
75
|
+
merge: number;
|
|
76
|
+
forcePush: boolean;
|
|
77
|
+
}>;
|
|
78
|
+
failBuild: (sha: string, failure?: {
|
|
79
|
+
job?: string;
|
|
80
|
+
failureReason?: string;
|
|
81
|
+
trace?: string;
|
|
82
|
+
}) => void;
|
|
83
|
+
/** The project's update settings, and the pipelines the update ran in, which tests add with `addUpdateRun()`. */
|
|
84
|
+
updateSettings: {
|
|
85
|
+
jobTokenPush: boolean;
|
|
86
|
+
schedules: Array<{
|
|
87
|
+
id: number;
|
|
88
|
+
ref: string;
|
|
89
|
+
cron: string;
|
|
90
|
+
active: boolean;
|
|
91
|
+
}>;
|
|
92
|
+
};
|
|
93
|
+
updateRuns: {
|
|
94
|
+
id: number;
|
|
95
|
+
source: string;
|
|
96
|
+
status: string;
|
|
97
|
+
variables?: Array<{
|
|
98
|
+
key: string;
|
|
99
|
+
value: string;
|
|
100
|
+
}>;
|
|
101
|
+
trace: string;
|
|
102
|
+
}[];
|
|
103
|
+
addUpdateRun: (run: {
|
|
104
|
+
source?: string;
|
|
105
|
+
status?: string;
|
|
106
|
+
trace?: string;
|
|
107
|
+
variables?: Array<{
|
|
108
|
+
key: string;
|
|
109
|
+
value: string;
|
|
110
|
+
}>;
|
|
111
|
+
}) => {
|
|
112
|
+
variables?: Array<{
|
|
113
|
+
key: string;
|
|
114
|
+
value: string;
|
|
115
|
+
}>;
|
|
116
|
+
id: number;
|
|
117
|
+
source: string;
|
|
118
|
+
status: string;
|
|
119
|
+
trace: string;
|
|
120
|
+
};
|
|
26
121
|
repo: FakeRepo;
|
|
122
|
+
/** Projects created through the API, by full path. */
|
|
123
|
+
created: Map<string, FakeCreatedProject>;
|
|
124
|
+
/** The site's GitLab Pages, if it has them, which tests can change. */
|
|
125
|
+
pages: FakeGitLabPages | undefined;
|
|
27
126
|
requests: Request[];
|
|
28
|
-
commit: (changes: FileChange[], message: string) => string;
|
|
127
|
+
commit: (changes: FileChange[], message: string, author?: string, branch?: string) => string;
|
|
29
128
|
authorize: (authorizeUrl: string) => string;
|
|
30
129
|
handle: (request: Request) => Promise<Response>;
|
|
31
130
|
fetch: typeof fetch;
|