diff --git a/__test/gitlab.test.ts b/__test/gitlab.test.ts deleted file mode 100644 index bb18bcdbb4dcc69723c0ac0f9aa1a479dbaffd11..0000000000000000000000000000000000000000 --- a/__test/gitlab.test.ts +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/__test/integration.test.ts b/__test/integration.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..daf5f30479680418940430e34ab88a30464b4e77 --- /dev/null +++ b/__test/integration.test.ts @@ -0,0 +1,3 @@ +test('add 1+1', () => { + expect(1+1).toBe(2) +}) \ No newline at end of file diff --git a/__test/methods.test.ts b/__test/methods.test.ts deleted file mode 100644 index 06dfb06035226ea4b5bd4e876943ab2f9d2d24c4..0000000000000000000000000000000000000000 --- a/__test/methods.test.ts +++ /dev/null @@ -1,16 +0,0 @@ -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 diff --git a/__test/unit.test.ts b/__test/unit.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..a3b497688249dca79098efef31bf668e713ae972 --- /dev/null +++ b/__test/unit.test.ts @@ -0,0 +1,18 @@ +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