Commits (2)
test('add 1+1', () => { import request from 'supertest'
expect(1+1).toBe(2) 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
import helpers from '../src/utils/helpers' import {helpers} from '../src/utils/helpers'
import gitlab from '../src/controller/gitlab' import {gitlab} from '../src/controller/gitlab'
test('[/utils/helpers] convert string to array', () => { test('[/utils/helpers] convert string to array', () => {
expect(helpers.stringToArray('foo')).toStrictEqual(["foo"]) expect(helpers.stringToArray('foo')).toStrictEqual(["foo"])
...@@ -14,5 +14,5 @@ test('[/controller/gitlab] get projects from gitlab', async () => { ...@@ -14,5 +14,5 @@ test('[/controller/gitlab] get projects from gitlab', async () => {
test('[/controller/gitlab] get latest pipeline status from gitlab', async () => { test('[/controller/gitlab] get latest pipeline status from gitlab', async () => {
expect(await gitlab.getLatestPipelineStatus(97)).toBe("success") expect(await gitlab.getLatestPipelineStatus(97)).toBe("success")
expect(await gitlab.getLatestPipelineStatus(0)).toBeUndefined expect(await gitlab.getLatestPipelineStatus(0)).toBeFalsy
}) })
\ No newline at end of file
This diff is collapsed.
import https from 'https' import https from 'https'
import {helpers} from '../utils/helpers' import { helpers } from '../utils/helpers'
import {gitlab} from './gitlab' import { gitlab } from './gitlab'
import {dbconn} from '../config/dbconn' import { dbconn } from '../config/dbconn'
const lang = 'DE' const lang = 'DE'
...@@ -239,4 +239,4 @@ const controller = { ...@@ -239,4 +239,4 @@ const controller = {
} }
} }
export {controller} export { controller }
...@@ -37,8 +37,8 @@ const gitlab = { ...@@ -37,8 +37,8 @@ const gitlab = {
url: 'https://transfer.hft-stuttgart.de/gitlab/api/v4/projects/' + String(projectId) + '/pipelines' url: 'https://transfer.hft-stuttgart.de/gitlab/api/v4/projects/' + String(projectId) + '/pipelines'
}) })
.then(res => res.data[0].status) .then(res => res.data[0].status)
.catch(err => console.error(err)) .catch(err => console.error(err.response))
} }
} }
export {gitlab} export { gitlab }
import {controller} from '../controller/controller' import { controller } from '../controller/controller'
module.exports = function (app: any) { module.exports = function (app: any) {
// ======== APP ROUTES - PROJECT ==================== // ======== APP ROUTES - PROJECT ====================
app.get('/', function (req: any, res: any) { app.get('/', function (req: any, res: any) {
controller.showHome(res) controller.showHome(res)
......
...@@ -5,4 +5,4 @@ const helpers = { ...@@ -5,4 +5,4 @@ const helpers = {
} }
} }
export {helpers} export { helpers }