Commits (2)
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 '../utils/helpers'
import gitlab from '../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
const helpers = {
stringToArray: function (input: string) {
if (input != null) {
if (!input) { return null }
return input.split(',')
} else {
return null
}
}
}
......