FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node-gitlab/tests/test.js at master · moul/node-gitlab · GitHub
This repository was archived by the owner on Oct 24, 2019. It is now read-only.
moul
/
node-gitlab
Public archive
Notifications
You must be signed in to change notification settings
Fork
137
Star
466
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
node-gitlab
/
tests
/
test.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
190 lines (177 loc) · 5.75 KB
Breadcrumbs
node-gitlab
/
tests
/
test.js
Copy path
File metadata and controls
190 lines (177 loc) · 5.75 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
(
function
(
)
{
var
Gitlab
,
assert
,
credentials
,
gitlab
,
mock
,
projectId
,
userId
,
validate_project
;
assert
=
require
(
'assert'
)
;
Gitlab
=
require
(
'..'
)
;
credentials
=
{
host
:
"http://demo.gitlab.com"
,
token
:
"Wvjy2Krpb7y8xi93owUz"
,
password
:
"123456"
,
login
:
"test@test.com"
}
;
gitlab
=
new
Gitlab
(
{
token
:
credentials
.
token
,
url
:
credentials
.
host
}
)
;
projectId
=
3
;
userId
=
1
;
validate_project
=
require
(
'./validators'
)
.
validate_project
;
mock
=
require
(
'./mock'
)
;
if
(
process
.
env
.
TEST_NO_MOCK
==
null
)
{
mock
.
setup
(
gitlab
)
;
}
describe
(
'User'
,
function
(
)
{
describe
(
'#all()'
,
function
(
)
{
return
it
(
'should retrieve array of users without error'
,
function
(
done
)
{
return
gitlab
.
users
.
all
(
function
(
result
)
{
return
done
(
)
;
}
)
;
}
)
;
}
)
;
describe
(
'#current()'
,
function
(
)
{
return
it
(
'should retrieve current user without error'
,
function
(
done
)
{
return
gitlab
.
users
.
current
(
function
(
result
)
{
return
done
(
)
;
}
)
;
}
)
;
}
)
;
describe
(
'#show()'
,
function
(
)
{
return
it
(
'should retrieve a single user'
,
function
(
done
)
{
return
gitlab
.
users
.
show
(
userId
,
function
(
result
)
{
return
done
(
)
;
}
)
;
}
)
;
}
)
;
return
describe
(
'#session()'
,
function
(
)
{
return
it
(
'should retrieve a users session without error'
,
function
(
done
)
{
return
gitlab
.
users
.
session
(
credentials
.
login
,
credentials
.
password
,
function
(
result
)
{
return
done
(
)
;
}
)
;
}
)
;
}
)
;
}
)
;
describe
(
'Project'
,
function
(
)
{
describe
(
'#all()'
,
function
(
)
{
beforeEach
(
function
(
)
{
return
mock
.
get
=
function
(
opts
,
cb
)
{
return
cb
(
null
,
{
}
,
mock
.
projects
)
;
}
;
}
)
;
return
it
(
'should retrieve array of projects without error'
,
function
(
done
)
{
return
gitlab
.
projects
.
all
(
function
(
projects
)
{
var
i
,
len
,
project
;
assert
(
projects
.
length
>
0
)
;
for
(
i
=
0
,
len
=
projects
.
length
;
i
<
len
;
i
++
)
{
project
=
projects
[
i
]
;
validate_project
(
project
)
;
}
return
done
(
)
;
}
)
;
}
)
;
}
)
;
describe
(
'#show()'
,
function
(
)
{
beforeEach
(
function
(
)
{
return
mock
.
get
=
function
(
opts
,
cb
)
{
var
project
;
project
=
mock
.
projects
[
0
]
;
project
.
id
=
parseInt
(
mock
.
path
.
split
(
'/'
)
.
slice
(
-
1
)
[
0
]
)
;
return
cb
(
null
,
{
}
,
project
)
;
}
;
}
)
;
return
it
(
'should retrieve single project'
,
function
(
done
)
{
return
gitlab
.
projects
.
show
(
projectId
,
function
(
project
)
{
assert
.
equal
(
project
.
id
,
projectId
)
;
validate_project
(
project
)
;
return
done
(
)
;
}
)
;
}
)
;
}
)
;
describe
(
'Members'
,
function
(
)
{
return
describe
(
'#listMembers()'
,
function
(
)
{
return
describe
(
'#list'
,
function
(
)
{
return
it
(
'should retrieve list of members of a project'
,
function
(
done
)
{
return
gitlab
.
projects
.
members
.
list
(
projectId
,
function
(
result
)
{
return
done
(
)
;
}
)
;
}
)
;
}
)
;
}
)
;
}
)
;
return
describe
(
'#repository'
,
function
(
)
{
describe
(
'#listBranches'
,
function
(
)
{
return
it
(
'should retrive branches of a given project'
,
function
(
done
)
{
return
gitlab
.
projects
.
repository
.
listBranches
(
projectId
,
function
(
result
)
{
return
done
(
)
;
}
)
;
}
)
;
}
)
;
describe
(
'#listCommits()'
,
function
(
)
{
return
it
(
'should retrieve commits of a given project'
,
function
(
done
)
{
return
gitlab
.
projects
.
repository
.
listCommits
(
projectId
,
function
(
result
)
{
return
done
(
)
;
}
)
;
}
)
;
}
)
;
describe
(
'#addTag()'
,
function
(
)
{
return
it
(
'should add a tag to a given project'
,
function
(
done
)
{
var
opts
;
opts
=
{
id
:
projectId
,
tag_name
:
"v1.0.0"
,
ref
:
"2695effb5807a22ff3d138d593fd856244e155e7"
,
message
:
"Annotated message"
,
release_description
:
"Release description"
}
;
return
gitlab
.
projects
.
repository
.
addTag
(
opts
,
function
(
result
)
{
return
done
(
)
;
}
)
;
}
)
;
}
)
;
describe
(
'#listTags()'
,
function
(
)
{
return
it
(
'should retrieve tags of a given project'
,
function
(
done
)
{
return
gitlab
.
projects
.
repository
.
listTags
(
projectId
,
function
(
result
)
{
return
done
(
)
;
}
)
;
}
)
;
}
)
;
describe
(
'#listTree()'
,
function
(
)
{
return
it
(
'should retrieve tree of a given project'
,
function
(
done
)
{
return
gitlab
.
projects
.
repository
.
listTree
(
projectId
,
function
(
result
)
{
return
done
(
)
;
}
)
;
}
)
;
}
)
;
return
describe
(
'#showFile()'
,
function
(
)
{
it
(
'should retrieve specified file with arity=3'
,
function
(
done
)
{
var
opts
;
opts
=
{
file_path
:
'README.md'
,
ref
:
'master'
}
;
return
gitlab
.
projects
.
repository
.
showFile
(
projectId
,
opts
,
function
(
result
)
{
return
done
(
)
;
}
)
;
}
)
;
return
it
(
'should retrieve specified file with arity=2'
,
function
(
done
)
{
var
opts
;
opts
=
{
projectId
:
projectId
,
file_path
:
'README.md'
,
ref
:
'master'
}
;
return
gitlab
.
projects
.
repository
.
showFile
(
opts
,
function
(
result
)
{
return
done
(
)
;
}
)
;
}
)
;
}
)
;
}
)
;
}
)
;
describe
(
'Issue'
,
function
(
)
{
return
describe
(
'#all()'
,
function
(
)
{
return
it
(
'should retrieve array of issues created by user'
,
function
(
done
)
{
return
gitlab
.
issues
.
all
(
function
(
result
)
{
return
done
(
)
;
}
)
;
}
)
;
}
)
;
}
)
;
}
)
.
call
(
this
)
;
Back
|
FazBrowse Home
|
New Git URL