Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • User Account User Account
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • m4lab_tv1
  • User AccountUser Account
  • Merge requests
  • !144
An error occurred while fetching the assigned milestone of the selected merge_request.

Refactoring and codes cleaning

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Rosanny Sihombing requested to merge devel into testing 3 years ago
  • Overview 0
  • Commits 33
  • Pipelines 0
  • Changes 69
  • Rosanny Sihombing @sihombing mentioned in commit 9fb60ffd 3 years ago

    mentioned in commit 9fb60ffd

  • Rosanny Sihombing @sihombing merged 3 years ago

    merged

  • Loading
  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
Compare
  • testing (base)

and
  • latest version
    4450156e
    33 commits, 3 years ago

69 files
+ 15587
- 9714

    Preferences

    File browser
    Compare changes
__t‎ests‎
db.unit‎.test.js‎ +50 -0
gitlab.un‎it.test.js‎ +14 -10
public.endp‎oint.test.js‎ +16 -0
__te‎sts__‎
method.un‎it.test.ts‎ +0 -52
cla‎sses‎
proje‎ct.ts‎ +0 -58
rep‎o.ts‎ +0 -9
use‎r.ts‎ +0 -97
websi‎te.ts‎ +0 -9
con‎fig‎
dbco‎nn.ts‎ +0 -39
func‎tions‎
gitl‎ab.ts‎ +0 -128
helpe‎rs.ts‎ +0 -11
metho‎ds.ts‎ +0 -215
publ‎ic/js‎
generalFu‎nction.js‎ +0 -9
headfoot‎Logout.js‎ +0 -241
registr‎ation.js‎ +0 -38
secur‎ity.js‎ +0 -30
route‎s/cert‎
cert‎.pem‎ +0 -33
cert_i‎dp.pem‎ +0 -1
key‎.pem‎ +0 -52
s‎rc‎
cla‎sses‎
proje‎ct.ts‎ +69 -0
rep‎o.ts‎ +9 -0
use‎r.ts‎ +113 -0
websi‎te.ts‎ +9 -0
con‎fig‎
conf‎ig.ts‎ +82 -0
cons‎t.ts‎ +8 -6
dbco‎nn.ts‎ +39 -0
mail‎er.ts‎ +15 -15
contr‎oller‎
dbContr‎oller.ts‎ +208 -0
gitlabCon‎troller.ts‎ +127 -0
publicCon‎troller.ts‎ +281 -0
pub‎lic‎
def‎ault‎
logo‎.png‎ +0 -0
j‎s‎
generalFu‎nction.js‎ +9 -0
headf‎oot.js‎ +224 -0
headfoot‎Logout.js‎ +237 -0
registr‎ation.js‎ +37 -0
secur‎ity.js‎ +30 -0
rou‎tes‎
accou‎nt.ts‎ +592 -0
publ‎ic.ts‎ +46 -0
vi‎ews‎
D‎E‎
acc‎ount‎
conta‎ct.pug‎ +0 -0
forgot‎Pwd.pug‎ +0 -0
home‎.pug‎ +0 -0
newInform‎ation.pug‎ +0 -0
profi‎le.pug‎ +1 -1
registra‎tion.pug‎ +0 -0
rese‎t.pug‎ +0 -0
securi‎ty.pug‎ +2 -2
servic‎es.pug‎ +5 -2
updateInfo‎rmation.pug‎ +0 -0
verifica‎tion.pug‎ +0 -0
pro‎ject‎
updateProjec‎tOverview.pug‎ +0 -0
404‎.pug‎ +0 -0
500‎.pug‎ +0 -0
E‎N‎
acc‎ount‎
forgot‎Pwd.pug‎ +0 -0
home‎.pug‎ +0 -0
profi‎le.pug‎ +0 -0
registra‎tion.pug‎ +0 -0
rese‎t.pug‎ +0 -0
securi‎ty.pug‎ +0 -0
servic‎es.pug‎ +0 -0
404‎.pug‎ +0 -0
500‎.pug‎ +0 -0
app‎.ts‎ +90 -0
.bab‎elrc‎ +5 -0
.giti‎gnore‎ +1 -1
app‎.ts‎ +0 -93
jest.co‎nfig.js‎ +4 -0
package-‎lock.json‎ +13228 -8549
packag‎e.json‎ +18 -7
tsconf‎ig.json‎ +18 -6
__tests/db.unit.test.js 0 → 100644
+ 50
- 0
  • View file @ 4450156e

  • Edit in single-file editor

  • Open in Web IDE

 
const dbController = require('../../src/controller/dbController')
 
 
describe('DB methohds test', () => {
 
it('returns a user from DB by email', async () => {
 
const user = await dbController.getUserByEmail('litehon958@whipjoy.com')
 
expect(user).not.toBeNull()
 
})
 
it('returns a null user', async () => {
 
const user = await dbController.getUserByEmail('jondoe@nowhere.com') // a non-exist user
 
expect(user).toBeNull()
 
})
 
 
it("returns a user's email", async () => {
 
const email = await dbController.getUserEmailById(1)
 
expect(email).not.toBeNull()
 
})
 
it("returns null instead of a user's email", async () => {
 
const email = await dbController.getUserEmailById(1005) // no user has this ID
 
expect(email).toBeNull()
 
})
 
 
it('returns null from DB by token', async () => {
 
const user = await dbController.getUserByToken('12345678') // unvalid token
 
expect(user).toBeNull() // for valid token = expect(user).not.toBeNull()
 
})
 
 
it("returns a user's verification token, if any", async () => {
 
const token = await dbController.getVerificationTokenByUserId(1)
 
expect(token).toBeNull()
 
})
 
 
it("returns a user's ID, if any", async () => {
 
const token = await dbController.getUserIdByVerificationToken('12345678') // unvalid token
 
expect(token).toBeNull() // for valid token = expect(user).not.toBeNull()
 
})
 
 
it("returns a user's GitLab_ID, if any", async () => {
 
const id = await dbController.getGitlabId(1)
 
expect(id).not.toBeNull()
 
})
 
 
it('checks user email', async () => {
 
const user = await dbController.checkUserEmail('litehon958@whipjoy.com')
 
expect(user).not.toBeNull()
 
})
 
it('checks user email and return null', async () => {
 
const user = await dbController.checkUserEmail('jondoe@nowhere.com') // a non-exist user
 
expect(user).toBeNull()
 
})
 
})
__tests__/gitlab.unit.test.ts → __tests/gitlab.unit.test.js
+ 14
- 10
  • View file @ 4450156e

  • Edit in single-file editor

  • Open in Web IDE

import gitlab from '../functions/gitlab'
const gitlabController = require('../src/controller/gitlabController')
//const axios = require('axios')
const axios = require('axios')
//jest.mock('axios')
 
jest.mock('axios')
describe('GitLab API', () => {
describe('GitLab API', () => {
test('returns an existing gitlab user by an email address', async () => {
test('returns an existing gitlab user by an email address', async () => {
let user = await gitlab.getUserByEmail('litehon958@whipjoy.com')
axios.get.mockResolvedValue({
 
 
})
 
const user = await gitlabController.getUserByEmail('litehon958@whipjoy.com')
expect(user).not.toBeNull()
expect(user).not.toBeNull()
})
})
test('returns an undefined user', async () => {
test('returns an undefined user', async () => {
let user = await gitlab.getUserByEmail('johndoe@nowhere.com')
const user = await gitlabController.getUserByEmail('johndoe@nowhere.com')
expect(user).toBeUndefined()
expect(user).toBeUndefined()
})
})
test('returns users project', async () => {
test('returns users project', async () => {
let userProjects = await gitlab.getUserProjects(136)
const userProjects = await gitlabController.getUserProjects(136)
expect(userProjects).toBeDefined()
expect(userProjects).toBeDefined()
})
})
test('returns undefined projects, due to non-existing gitlab user ID', async () => {
test('returns undefined projects, due to non-existing gitlab user ID', async () => {
let userProjects = await gitlab.getUserProjects(0)
const userProjects = await gitlabController.getUserProjects(0)
expect(userProjects).toBeUndefined()
expect(userProjects).toBeUndefined()
})
})
test('returns a project by ID', async () => {
test('returns a project by ID', async () => {
let project = await gitlab.getProjectById(13) // m4lab_landing_page
const project = await gitlabController.getProjectById(13) // m4lab_landing_page
expect(project).toBeDefined()
expect(project).toBeDefined()
})
})
test('returns undefined, due to invalid project ID', async () => {
test('returns undefined, due to invalid project ID', async () => {
let project = await gitlab.getProjectById(0)
const project = await gitlabController.getProjectById(0)
expect(project).toBeUndefined()
expect(project).toBeUndefined()
})
})
})
})
\ No newline at end of file
__tests/public.endpoint.test.js 0 → 100644
+ 16
- 0
  • View file @ 4450156e

  • Edit in single-file editor

  • Open in Web IDE

 
const request = require('supertest')
 
const express = require('express')
 
 
const app = express()
 
app.set('port', 9989)
 
 
describe('Test endpoint(s)', () => {
 
it('should return a 200 status code', () => {
 
request(app)
 
.get('/contact')
 
.expect(200)
 
.end(function (err, res) {
 
if (err) throw err
 
})
 
})
 
})
__tests__/method.unit.test.ts deleted 100644 → 0
+ 0
- 52
  • View file @ 961ab112

import methods from '../functions/methods'
describe("DB methohds test", () => {
it("returns a user from DB by email", async() => {
const user = await methods.getUserByEmail('litehon958@whipjoy.com')
expect(user).not.toBeNull()
})
it("returns a null user", async() => {
const user = await methods.getUserByEmail('jondoe@nowhere.com') // a non-exist user
expect(user).toBeNull()
})
it("returns a user's email", async() => {
const email = await methods.getUserEmailById(1)
expect(email).not.toBeNull()
})
it("returns null instead of a user's email", async() => {
const email = await methods.getUserEmailById(1005) // no user has this ID
expect(email).toBeNull()
})
it("returns null from DB by token", async() => {
const user = await methods.getUserByToken('12345678') // unvalid token
expect(user).toBeNull() // for valid token = expect(user).not.toBeNull()
})
it("returns a user's verification token, if any", async() => {
const token = await methods.getVerificationTokenByUserId(1)
expect(token).toBeNull()
})
it("returns a user's ID, if any", async() => {
const token = await methods.getUserIdByVerificationToken('12345678') // unvalid token
expect(token).toBeNull() // for valid token = expect(user).not.toBeNull()
})
it("returns a user's GitLab_ID, if any", async() => {
const id = await methods.getGitlabId(1)
expect(id).not.toBeNull()
})
it("checks user email", async() => {
const user = await methods.checkUserEmail('litehon958@whipjoy.com')
expect(user).not.toBeNull()
})
it("checks user email and return null", async() => {
const user = await methods.checkUserEmail('jondoe@nowhere.com') // a non-exist user
expect(user).toBeNull()
})
})
\ No newline at end of file
classes/project.ts deleted 100644 → 0
+ 0
- 58
  • View file @ 961ab112

class Project {
ownerGitlabId:number
name:string
desc:string
id?:number
logo?:string
path?:string
constructor(ownerGitlabId:number, name:string, desc:string, id?:number, logo?:string, path?:string) {
this.ownerGitlabId = ownerGitlabId
this.name = name
this.desc = desc
this.id = id
this.logo = logo
this.path = path
}
// getter
getOwnerGitlabId() {
return this.ownerGitlabId
}
getId() {
return this.id
}
getName() {
return this.name
}
getDesc() {
return this.desc
}
getLogo() {
return this.logo
}
getPath() {
return this.path
}
// setter
setOwnerGitlabId(newOwnerGitlabId:number){
this.ownerGitlabId = newOwnerGitlabId
}
setId(newId:number) {
this.id = newId
}
setName(newName:string) {
this.name = newName
}
setDesc(newDesc:string) {
this.desc = newDesc
}
setLogo(newLogoUrl:string) {
this.logo = newLogoUrl
}
setPath(newPath:string) {
this.path = newPath
}
}
export = Project
\ No newline at end of file
0 Assignees
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference:
Source branch: devel

Menu

Explore Projects Groups Snippets

Dies ist die Gitlab-Instanz des Transferportals der Hochschule für Technik Stuttgart. Hier geht es zurück zum Portal