@@ -30,37 +30,25 @@ describe("parseJobUrl", () => {
3030 } ) ;
3131
3232 it ( "accepts a valid URL with trailing slash" , ( ) => {
33- const result = parseJobUrl (
34- "https://github.com/owner/repo/actions/runs/111/job/222/" ,
35- GITHUB_API_URI
36- ) ;
33+ const result = parseJobUrl ( "https://github.com/owner/repo/actions/runs/111/job/222/" , GITHUB_API_URI ) ;
3734 expect ( result ) . toEqual ( { valid : true , owner : "owner" , repo : "repo" , jobId : "222" } ) ;
3835 } ) ;
3936
4037 it ( "ignores query string and hash" , ( ) => {
41- const result = parseJobUrl (
42- "https://github.com/owner/repo/actions/runs/111/job/222?pr=1#step:2:3" ,
43- GITHUB_API_URI
44- ) ;
38+ const result = parseJobUrl ( "https://github.com/owner/repo/actions/runs/111/job/222?pr=1#step:2:3" , GITHUB_API_URI ) ;
4539 expect ( result ) . toEqual ( { valid : true , owner : "owner" , repo : "repo" , jobId : "222" } ) ;
4640 } ) ;
4741
4842 it ( "rejects wrong host" , ( ) => {
49- const result = parseJobUrl (
50- "https://gitlab.com/owner/repo/actions/runs/111/job/222" ,
51- GITHUB_API_URI
52- ) ;
43+ const result = parseJobUrl ( "https://gitlab.com/owner/repo/actions/runs/111/job/222" , GITHUB_API_URI ) ;
5344 expect ( result . valid ) . toBe ( false ) ;
5445 if ( ! result . valid ) {
5546 expect ( result . reason ) . toContain ( "gitlab.com" ) ;
5647 }
5748 } ) ;
5849
5950 it ( "rejects http:// scheme" , ( ) => {
60- const result = parseJobUrl (
61- "http://github.com/owner/repo/actions/runs/111/job/222" ,
62- GITHUB_API_URI
63- ) ;
51+ const result = parseJobUrl ( "http://github.com/owner/repo/actions/runs/111/job/222" , GITHUB_API_URI ) ;
6452 expect ( result . valid ) . toBe ( false ) ;
6553 if ( ! result . valid ) {
6654 expect ( result . reason ) . toContain ( "https://" ) ;
@@ -97,29 +85,20 @@ describe("parseJobUrl", () => {
9785 } ) ;
9886
9987 it ( "rejects URL with credentials" , ( ) => {
100- const result = parseJobUrl (
101- "https://user:pass@github.com/owner/repo/actions/runs/111/job/222" ,
102- GITHUB_API_URI
103- ) ;
88+ const result = parseJobUrl ( "https://user:pass@github.com/owner/repo/actions/runs/111/job/222" , GITHUB_API_URI ) ;
10489 expect ( result . valid ) . toBe ( false ) ;
10590 if ( ! result . valid ) {
10691 expect ( result . reason ) . toContain ( "Credentials" ) ;
10792 }
10893 } ) ;
10994
11095 it ( "accepts non-numeric job ID" , ( ) => {
111- const result = parseJobUrl (
112- "https://github.com/owner/repo/actions/runs/111/job/abc-123" ,
113- GITHUB_API_URI
114- ) ;
96+ const result = parseJobUrl ( "https://github.com/owner/repo/actions/runs/111/job/abc-123" , GITHUB_API_URI ) ;
11597 expect ( result ) . toEqual ( { valid : true , owner : "owner" , repo : "repo" , jobId : "abc-123" } ) ;
11698 } ) ;
11799
118100 it ( "accepts plural /jobs/ path variant" , ( ) => {
119- const result = parseJobUrl (
120- "https://github.com/owner/repo/actions/runs/111/jobs/222" ,
121- GITHUB_API_URI
122- ) ;
101+ const result = parseJobUrl ( "https://github.com/owner/repo/actions/runs/111/jobs/222" , GITHUB_API_URI ) ;
123102 expect ( result ) . toEqual ( { valid : true , owner : "owner" , repo : "repo" , jobId : "222" } ) ;
124103 } ) ;
125104
0 commit comments