FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql-action/src/github.test.ts at mbg/classify-changes · github/codeql-action · GitHub
github
codeql-action
Repository navigation
Code
Issues
165
(165)
Pull requests
45
(45)
Actions
Security and quality
2
(2)
Insights
Expand file tree
Breadcrumbs
codeql-action
/
src
/
github.test.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
111 lines (100 loc) · 3.21 KB
Breadcrumbs
codeql-action
/
src
/
github.test.ts
Copy path
File metadata and controls
111 lines (100 loc) · 3.21 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import
test
from
"ava"
;
import
{
ActionsEnvVars
}
from
"./environment"
;
import
*
as
github
from
"./github"
;
import
{
getTestEnv
,
setupTests
}
from
"./testing-utils"
;
setupTests
(
test
)
;
test
(
"parseGitHubUrl"
,
(
t
)
=>
{
t
.
deepEqual
(
github
.
parseGitHubUrl
(
"github.com"
)
,
"https://github.com"
)
;
t
.
deepEqual
(
github
.
parseGitHubUrl
(
"https://github.com"
)
,
"https://github.com"
,
)
;
t
.
deepEqual
(
github
.
parseGitHubUrl
(
"https://api.github.com"
)
,
"https://github.com"
,
)
;
t
.
deepEqual
(
github
.
parseGitHubUrl
(
"https://github.com/foo/bar"
)
,
"https://github.com"
,
)
;
t
.
deepEqual
(
github
.
parseGitHubUrl
(
"github.example.com"
)
,
"https://github.example.com/"
,
)
;
t
.
deepEqual
(
github
.
parseGitHubUrl
(
"https://github.example.com"
)
,
"https://github.example.com/"
,
)
;
t
.
deepEqual
(
github
.
parseGitHubUrl
(
"https://api.github.example.com"
)
,
"https://github.example.com/"
,
)
;
t
.
deepEqual
(
github
.
parseGitHubUrl
(
"https://github.example.com/api/v3"
)
,
"https://github.example.com/"
,
)
;
t
.
deepEqual
(
github
.
parseGitHubUrl
(
"https://github.example.com:1234"
)
,
"https://github.example.com:1234/"
,
)
;
t
.
deepEqual
(
github
.
parseGitHubUrl
(
"https://api.github.example.com:1234"
)
,
"https://github.example.com:1234/"
,
)
;
t
.
deepEqual
(
github
.
parseGitHubUrl
(
"https://github.example.com:1234/api/v3"
)
,
"https://github.example.com:1234/"
,
)
;
t
.
deepEqual
(
github
.
parseGitHubUrl
(
"https://github.example.com/base/path"
)
,
"https://github.example.com/base/path/"
,
)
;
t
.
deepEqual
(
github
.
parseGitHubUrl
(
"https://github.example.com/base/path/api/v3"
)
,
"https://github.example.com/base/path/"
,
)
;
t
.
throws
(
(
)
=>
github
.
parseGitHubUrl
(
""
)
,
{
message
:
'"" is not a valid URL'
,
}
)
;
t
.
throws
(
(
)
=>
github
.
parseGitHubUrl
(
"ssh://github.com"
)
,
{
message
:
'"ssh://github.com" is not a http or https URL'
,
}
)
;
t
.
throws
(
(
)
=>
github
.
parseGitHubUrl
(
"http:///::::433"
)
,
{
message
:
'"http:///::::433" is not a valid URL'
,
}
)
;
}
)
;
test
(
"getCurrentInstance throws if required env vars aren't set"
,
(
t
)
=>
{
t
.
throws
(
(
)
=>
github
.
getCurrentInstance
(
getTestEnv
(
)
)
)
;
t
.
throws
(
(
)
=>
{
const
env
=
getTestEnv
(
{
[
ActionsEnvVars
.
GITHUB_SERVER_URL
]
:
"https://localhost"
,
}
)
;
github
.
getCurrentInstance
(
env
)
;
}
)
;
t
.
throws
(
(
)
=>
{
const
env
=
getTestEnv
(
{
[
ActionsEnvVars
.
GITHUB_API_URL
]
:
"https://api.localhost"
,
}
)
;
github
.
getCurrentInstance
(
env
)
;
}
)
;
}
)
;
test
(
"getCurrentInstance constructs instance from environment"
,
(
t
)
=>
{
const
url
=
"https://localhost"
;
const
apiUrl
=
"https://api.localhost"
;
const
env
=
getTestEnv
(
{
[
ActionsEnvVars
.
GITHUB_SERVER_URL
]
:
url
,
[
ActionsEnvVars
.
GITHUB_API_URL
]
:
apiUrl
,
}
)
;
const
instance
=
github
.
getCurrentInstance
(
env
)
;
t
.
is
(
instance
.
url
,
url
)
;
t
.
is
(
instance
.
apiURL
,
apiUrl
)
;
}
)
;
test
(
"getCurrentInstance constructs dotcom instance with dotcom env vars"
,
(
t
)
=>
{
const
env
=
getTestEnv
(
{
[
ActionsEnvVars
.
GITHUB_SERVER_URL
]
:
github
.
GITHUB_DOTCOM_URL
,
[
ActionsEnvVars
.
GITHUB_API_URL
]
:
github
.
GITHUB_DOTCOM_API_URL
,
}
)
;
const
instance
=
github
.
getCurrentInstance
(
env
)
;
const
dotcomInstance
=
github
.
getDotcomInstance
(
)
;
t
.
deepEqual
(
dotcomInstance
,
instance
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL