gitlab.unit.test.js 791 bytes
const gitlab = require('../routes/gitlab')
const axios = require('axios')
beforeAll(() => {
    // test gitlab API connection
    var config = {
        method: 'get',
        url: 'https://transfer.hft-stuttgart.de/gitlab/api/v4/projects'
    axios(config)
    .then(function (response) {
        expect(response.statusCode).toBe(200)
describe('GitLab API test', () => {
    test("Get a gitlab userID by email", () => { // email = any email address
        gitlab.getUserIdByEmail("test@email.de", function(resp){
            expect(resp).not.toBeNull()
    test("Get the projects of a particular user", () => { // userID = any integer
        gitlab.getUserProjects(3, function(resp){
            expect(resp).not.toBeNull()