MCPcopy Create free account
hub / github.com/angular/dev-infra / createTestPullRequest

Function createTestPullRequest

ng-dev/pr/common/test/common.spec.ts:277–315  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

275 const config = createIsolatedValidationConfig({assertEnforceTested: true});
276 let pr = createTestPullRequest();
277 const comments = [
278 {
279 authorAssociation: 'MEMBER' as CommentAuthorAssociation,
280 author: {
281 login: 'fakelogin',
282 },
283 bodyText: 'TESTED="blah"',
284 createdAt: '2026-07-13T12:00:00Z',
285 },
286 ];
287 const commentHelper = PullRequestComments.create(git, pr.number);
288 spyOn(PullRequestComments, 'create').and.returnValue(commentHelper);
289 spyOn(commentHelper, 'loadPullRequestComments').and.returnValue(Promise.resolve(comments));
290
291 pr.labels.nodes.push({name: requiresLabels['REQUIRES_TGP'].name});
292 interceptOrgsMembershipRequest('fakelogin', true);
293 const results = await assertValidPullRequest(pr, config, ngDevConfig, null, prTarget, git);
294 expect(results.length).toBe(0);
295 });
296
297 it('should not pass when label is present and TESTED comment exists from non-googler', async () => {
298 const config = createIsolatedValidationConfig({assertEnforceTested: true});
299 let pr = createTestPullRequest();
300 const comments = [
301 {
302 authorAssociation: 'MEMBER' as CommentAuthorAssociation,
303 author: {
304 login: 'fakelogin',
305 },
306 bodyText: 'TESTED="blah"',
307 createdAt: '2026-07-13T12:00:00Z',
308 },
309 ];
310 const commentHelper = PullRequestComments.create(git, pr.number);
311 spyOn(PullRequestComments, 'create').and.returnValue(commentHelper);
312 spyOn(commentHelper, 'loadPullRequestComments').and.returnValue(Promise.resolve(comments));
313 pr.labels.nodes.push({name: requiresLabels['REQUIRES_TGP'].name});
314 interceptOrgsMembershipRequest('fakelogin', false);
315 const results = await assertValidPullRequest(pr, config, ngDevConfig, null, prTarget, git);
316 expect(results.length).toBe(1);
317 });
318

Callers 1

common.spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected