Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
m4lab_tv1
Project Page
Commits
03032c6b
Commit
03032c6b
authored
Jun 27, 2022
by
Rosanny Sihombing
Browse files
test update and minor update
parent
7018d935
Changes
6
Hide whitespace changes
Inline
Side-by-side
__test/integration.test.ts
View file @
03032c6b
test
(
'
add 1+1
'
,
()
=>
{
expect
(
1
+
1
).
toBe
(
2
)
import
request
from
'
supertest
'
const
express
=
require
(
'
express
'
);
const
app
=
express
();
app
.
set
(
'
port
'
,
8888
)
describe
(
'
Test endpoint(s)
'
,
()
=>
{
it
(
'
should return a 200 status code
'
,
async
()
=>
{
request
(
app
)
.
get
(
'
/mailinglists
'
)
.
expect
(
200
)
.
end
(
function
(
err
,
res
)
{
if
(
err
)
throw
err
;
});
});
it
(
'
should return a 200 status code
'
,
async
()
=>
{
request
(
app
)
.
get
(
'
/projektdaten
'
)
.
expect
(
200
)
.
end
(
function
(
err
,
res
)
{
if
(
err
)
throw
err
;
});
});
it
(
'
should return a 200 status code
'
,
async
()
=>
{
request
(
app
)
.
get
(
'
/projektinformationen
'
)
.
expect
(
200
)
.
end
(
function
(
err
,
res
)
{
if
(
err
)
throw
err
;
});
});
it
(
'
should return a 200 status code
'
,
async
()
=>
{
request
(
app
)
.
get
(
'
/projectoverview?projectID=1
'
)
.
expect
(
200
)
.
end
(
function
(
err
,
res
)
{
if
(
err
)
throw
err
;
});
});
})
\ No newline at end of file
__test/unit.test.ts
View file @
03032c6b
import
helpers
from
'
../src/utils/helpers
'
import
gitlab
from
'
../src/controller/gitlab
'
import
{
helpers
}
from
'
../src/utils/helpers
'
import
{
gitlab
}
from
'
../src/controller/gitlab
'
test
(
'
[/utils/helpers] convert string to array
'
,
()
=>
{
expect
(
helpers
.
stringToArray
(
'
foo
'
)).
toStrictEqual
([
"
foo
"
])
...
...
@@ -14,5 +14,5 @@ test('[/controller/gitlab] get projects from gitlab', async () => {
test
(
'
[/controller/gitlab] get latest pipeline status from gitlab
'
,
async
()
=>
{
expect
(
await
gitlab
.
getLatestPipelineStatus
(
97
)).
toBe
(
"
success
"
)
expect
(
await
gitlab
.
getLatestPipelineStatus
(
0
)).
toBe
Undefined
expect
(
await
gitlab
.
getLatestPipelineStatus
(
0
)).
toBe
Falsy
})
\ No newline at end of file
src/controller/controller.ts
View file @
03032c6b
import
https
from
'
https
'
import
{
helpers
}
from
'
../utils/helpers
'
import
{
gitlab
}
from
'
./gitlab
'
import
{
dbconn
}
from
'
../config/dbconn
'
import
{
helpers
}
from
'
../utils/helpers
'
import
{
gitlab
}
from
'
./gitlab
'
import
{
dbconn
}
from
'
../config/dbconn
'
const
lang
=
'
DE
'
...
...
@@ -239,4 +239,4 @@ const controller = {
}
}
export
{
controller
}
export
{
controller
}
src/controller/gitlab.ts
View file @
03032c6b
...
...
@@ -37,8 +37,8 @@ const gitlab = {
url
:
'
https://transfer.hft-stuttgart.de/gitlab/api/v4/projects/
'
+
String
(
projectId
)
+
'
/pipelines
'
})
.
then
(
res
=>
res
.
data
[
0
].
status
)
.
catch
(
err
=>
console
.
error
(
err
))
.
catch
(
err
=>
console
.
error
(
err
.
response
))
}
}
export
{
gitlab
}
export
{
gitlab
}
src/routes/project.ts
View file @
03032c6b
import
{
controller
}
from
'
../controller/controller
'
import
{
controller
}
from
'
../controller/controller
'
module
.
exports
=
function
(
app
:
any
)
{
// ======== APP ROUTES - PROJECT ====================
// ======== APP ROUTES - PROJECT ====================
app
.
get
(
'
/
'
,
function
(
req
:
any
,
res
:
any
)
{
controller
.
showHome
(
res
)
...
...
src/utils/helpers.ts
View file @
03032c6b
...
...
@@ -5,4 +5,4 @@ const helpers = {
}
}
export
{
helpers
}
export
{
helpers
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment