@@ -19,19 +19,12 @@ describe("sendRequest", () => {
1919 const bcr = new Repository ( "bazel-central-registry" , "bazelbuild" ) ;
2020 const branch = "branch_with_entry" ;
2121 const tag = "v1.0.0" ;
22- const releaser = {
23- name : "Json Bearded" ,
24- username : "json" ,
25- 26- } ;
2722
2823 await publishEntryService . sendRequest (
2924 tag ,
3025 bcrFork ,
3126 bcr ,
3227 branch ,
33- releaser ,
34- [ ] ,
3528 "rules_foo" ,
3629 `github.com/aspect-build/rules_foo/releases/tag/${ tag } `
3730 ) ;
@@ -51,19 +44,12 @@ describe("sendRequest", () => {
5144 const bcr = new Repository ( "bazel-central-registry" , "bazelbuild" ) ;
5245 const branch = "branch_with_entry" ;
5346 const tag = "v1.0.0" ;
54- const releaser = {
55- name : "Json Bearded" ,
56- username : "json" ,
57- 58- } ;
5947
6048 await publishEntryService . sendRequest (
6149 tag ,
6250 bcrFork ,
6351 bcr ,
6452 branch ,
65- releaser ,
66- [ ] ,
6753 "rules_foo" ,
6854 `github.com/aspect-build/rules_foo/releases/tag/${ tag } `
6955 ) ;
@@ -86,56 +72,17 @@ describe("sendRequest", () => {
8672 ) ;
8773 } ) ;
8874
89- test ( "tags the releaser in the body" , async ( ) => {
90- const bcrFork = new Repository ( "bazel-central-registry" , "bar" ) ;
91- const bcr = new Repository ( "bazel-central-registry" , "bazelbuild" ) ;
92- const branch = "branch_with_entry" ;
93- const tag = "v1.0.0" ;
94- const releaser = {
95- name : "Json Bearded" ,
96- username : "json" ,
97- 98- } ;
99-
100- await publishEntryService . sendRequest (
101- tag ,
102- bcrFork ,
103- bcr ,
104- branch ,
105- releaser ,
106- [ ] ,
107- "rules_foo" ,
108- `github.com/aspect-build/rules_foo/releases/tag/${ tag } `
109- ) ;
110-
111- expect ( mockGithubClient . createPullRequest ) . toHaveBeenCalledWith (
112- expect . any ( Repository ) ,
113- expect . any ( String ) ,
114- expect . any ( Repository ) ,
115- expect . any ( String ) ,
116- expect . any ( String ) ,
117- expect . stringContaining ( `@${ releaser . username } ` )
118- ) ;
119- } ) ;
120-
12175 test ( "includes the release url in the body" , async ( ) => {
12276 const bcrFork = new Repository ( "bazel-central-registry" , "bar" ) ;
12377 const bcr = new Repository ( "bazel-central-registry" , "bazelbuild" ) ;
12478 const branch = "branch_with_entry" ;
12579 const tag = "v1.0.0" ;
126- const releaser = {
127- name : "Json Bearded" ,
128- username : "json" ,
129- 130- } ;
13180
13281 await publishEntryService . sendRequest (
13382 tag ,
13483 bcrFork ,
13584 bcr ,
13685 branch ,
137- releaser ,
138- [ ] ,
13986 "rules_foo" ,
14087 `github.com/aspect-build/rules_foo/releases/tag/${ tag } `
14188 ) ;
@@ -152,83 +99,11 @@ describe("sendRequest", () => {
15299 ) ;
153100 } ) ;
154101
155- test ( "tags all maintainers with github handles in the body" , async ( ) => {
156- const bcrFork = new Repository ( "bazel-central-registry" , "bar" ) ;
157- const bcr = new Repository ( "bazel-central-registry" , "bazelbuild" ) ;
158- const branch = "branch_with_entry" ;
159- const tag = "v1.0.0" ;
160- const releaser = {
161- name : "Json Bearded" ,
162- username : "json" ,
163- 164- } ;
165- const maintainers = [
166- { name : "M1" , github : "m1" } ,
167- { name :
"M2" , email :
"[email protected] " } , 168- { name :
"M3" , github :
"m3" , email :
"[email protected] " } , 169- { name : "M4" } ,
170- ] ;
171-
172- await publishEntryService . sendRequest (
173- tag ,
174- bcrFork ,
175- bcr ,
176- branch ,
177- releaser ,
178- maintainers ,
179- "rules_foo" ,
180- `github.com/aspect-build/rules_foo/releases/tag/${ tag } `
181- ) ;
182-
183- const body = mockGithubClient . createPullRequest . mock . calls [ 0 ] [ 5 ] ;
184- expect ( body . includes ( "@m1" ) ) . toEqual ( true ) ;
185- expect ( body . includes ( "@m2" ) ) . toEqual ( false ) ;
186- expect ( body . includes ( "@m3" ) ) . toEqual ( true ) ;
187- expect ( body . includes ( "@m4" ) ) . toEqual ( false ) ;
188- } ) ;
189-
190- test ( "does not double tag the release author if they are also a maintainer" , async ( ) => {
191- const bcrFork = new Repository ( "bazel-central-registry" , "bar" ) ;
192- const bcr = new Repository ( "bazel-central-registry" , "bazelbuild" ) ;
193- const branch = "branch_with_entry" ;
194- const tag = "v1.0.0" ;
195- const releaser = {
196- name : "Json Bearded" ,
197- username : "json" ,
198- 199- } ;
200- const maintainers = [
201- { name : "M1" , github : "m1" } ,
202- { name : releaser . name , github : releaser . username } ,
203- ] ;
204-
205- await publishEntryService . sendRequest (
206- tag ,
207- bcrFork ,
208- bcr ,
209- branch ,
210- releaser ,
211- maintainers ,
212- "rules_foo" ,
213- `github.com/aspect-build/rules_foo/releases/tag/${ tag } `
214- ) ;
215-
216- const body = mockGithubClient . createPullRequest . mock . calls [ 0 ] [ 5 ] ;
217- expect (
218- ( body . match ( new RegExp ( `@${ releaser . username } ` , "gm" ) ) || [ ] ) . length
219- ) . toEqual ( 1 ) ;
220- } ) ;
221-
222- test ( "creates the created pull request number" , async ( ) => {
102+ test ( "returns the created pull request number" , async ( ) => {
223103 const bcrFork = new Repository ( "bazel-central-registry" , "bar" ) ;
224104 const bcr = new Repository ( "bazel-central-registry" , "bazelbuild" ) ;
225105 const branch = "branch_with_entry" ;
226106 const tag = "v1.0.0" ;
227- const releaser = {
228- name : "Json Bearded" ,
229- username : "json" ,
230- 231- } ;
232107
233108 mockGithubClient . createPullRequest . mockResolvedValueOnce ( 4 ) ;
234109
@@ -237,8 +112,6 @@ describe("sendRequest", () => {
237112 bcrFork ,
238113 bcr ,
239114 branch ,
240- releaser ,
241- [ ] ,
242115 "rules_foo" ,
243116 `github.com/aspect-build/rules_foo/releases/tag/${ tag } `
244117 ) ;
0 commit comments