Commits (5)
......@@ -5,7 +5,7 @@ pages-testing:
- npm run clean
- npm run build
- rm -rf ./built/views
- cp -R ./views ./built
- cp -R ./src/views ./built
- cat $configfiledev > ./built/config/config.js
- "pm2 delete --silent project || :"
- pm2 start ./built/app.js --name=project
......
const gitlab = require('../functions/gitlab')
describe('GitLab API', () => {
test('get all projects', async () => {
let projects = await gitlab.getProjects(10, 0)
expect(projects).not.toBeNull()
})
test('get latest pipeline status of a project', async () => {
let status = await gitlab.getLatestPipelineStatus(81)
expect(status).not.toBeNull()
})
})
\ No newline at end of file
test('add 1+1', () => {
expect(1+1).toBe(2)
})
\ No newline at end of file
const methods = require('../functions/methods')
describe('DB methods', () => {
test('all mailinglists', async () => {
let lists = await methods.getAllMailinglists(0)
expect(lists).not.toBeNull()
})
test('project overview', async () => {
let overview = await methods.getProjectOverviewById(81)
expect(overview).not.toBeNull()
})
test('project images', async () => {
let images = await methods.getProjectImagesById(81)
expect(images).not.toBeNull()
})
})
\ No newline at end of file
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"])
expect(helpers.stringToArray('foo,bar')).toStrictEqual(["foo","bar"])
expect(helpers.stringToArray('')).toBeNull
expect(helpers.stringToArray(String(null))).toBeNull
});
test('[/controller/gitlab] get projects from gitlab', async () => {
expect(await gitlab.getProjects(100, 0)).not.toBeNull
})
test('[/controller/gitlab] get latest pipeline status from gitlab', async () => {
expect(await gitlab.getLatestPipelineStatus(97)).toBe("success")
expect(await gitlab.getLatestPipelineStatus(0)).toBeUndefined
})
\ No newline at end of file
......@@ -14,10 +14,11 @@
"url": "https://transfer.hft-stuttgart.de/gitlab/m4lab_tv1/project-page.git"
},
"scripts": {
"start:dev": "nodemon app.ts",
"start:dev": "nodemon ./src/app.ts",
"start": "nodemon ./built/app.js",
"build": "tsc -build",
"clean": "tsc -build --clean",
"check-types": "tsc",
"test": "jest",
"cleancode": "ts-standard --fix"
},
......
import helpers from '../functions/helpers'
import gitlab from '../functions/gitlab'
import helpers from '../utils/helpers'
import gitlab from './gitlab'
import https from 'https'
const dbconn = require('../config/dbconn')
......
const helpers = {
stringToArray: function (input: string) {
if (input != null) {
return input.split(',')
} else {
return null
}
if (!input) { return null }
return input.split(',')
}
}
......