unit.test.js 738 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
import { helpers } from '../built/utils/helpers'
import { gitlab } from '../built/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)).toBeFalsy
})