const gitlabController = require('../src/controller/gitlabController') const axios = require('axios') jest.mock('axios') describe('GitLab API', () => { test('returns an existing gitlab user by an email address', async () => { axios.get.mockResolvedValue({ }) const user = await gitlabController.getUserByEmail('litehon958@whipjoy.com') expect(user).not.toBeNull() }) test('returns an undefined user', async () => { const user = await gitlabController.getUserByEmail('johndoe@nowhere.com') expect(user).toBeUndefined() }) test('returns users project', async () => { const userProjects = await gitlabController.getUserProjects(136) expect(userProjects).toBeDefined() }) test('returns undefined projects, due to non-existing gitlab user ID', async () => { const userProjects = await gitlabController.getUserProjects(0) expect(userProjects).toBeUndefined() }) test('returns a project by ID', async () => { const project = await gitlabController.getProjectById(13) // m4lab_landing_page expect(project).toBeDefined() }) test('returns undefined, due to invalid project ID', async () => { const project = await gitlabController.getProjectById(0) expect(project).toBeUndefined() }) })