gitlab.unit.test.js 791 Bytes
Newer Older
Rosanny Sihombing's avatar
Rosanny Sihombing committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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()
        })
    })
})