Commit bfd88ffe authored by Rosanny Sihombing's avatar Rosanny Sihombing
Browse files

tests in JS

parent 425311b9
import request from 'supertest'
const express = require('express')
const app = express()
app.set('port', 8888)
describe('Test endpoint(s)', () => {
it('should return a 200 status code', async () => {
request(app)
.get('/mailinglists')
.expect(200)
.end(function (err, res) {
if (err) throw err
})
})
it('should return a 200 status code', async () => {
request(app)
.get('/projektdaten')
.expect(200)
.end(function (err, res) {
if (err) throw err
})
})
it('should return a 200 status code', async () => {
request(app)
.get('/projektinformationen')
.expect(200)
.end(function (err, res) {
if (err) throw err
})
})
it('should return a 200 status code', async () => {
request(app)
.get('/projectoverview?projectID=1')
.expect(200)
.end(function (err, res) {
if (err) throw err
})
})
})
test('add 1+1', () => {
expect(1+1).toBe(2)
})
\ No newline at end of file
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
})
import helpers from '../src/utils/helpers'
import gitlab from '../src/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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment