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

Merge branch 'cherry-pick-c8c8abc3' into 'testing'

add unit test (jest)

See merge request !54
parents c0e4d9e6 1b7070f8
Pipeline #4567 failed with stage
in 1 second
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
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
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
\ No newline at end of file
This diff is collapsed.
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"start": "nodemon app.ts", "start": "nodemon app.ts",
"build": "tsc -build", "build": "tsc -build",
"clean": "tsc -build --clean", "clean": "tsc -build --clean",
"test": "" "test": "jest"
}, },
"dependencies": { "dependencies": {
"async": "^3.2.0", "async": "^3.2.0",
...@@ -43,9 +43,12 @@ ...@@ -43,9 +43,12 @@
"@types/express-fileupload": "^1.1.6", "@types/express-fileupload": "^1.1.6",
"@types/express-flash": "^0.0.2", "@types/express-flash": "^0.0.2",
"@types/express-session": "^1.17.3", "@types/express-session": "^1.17.3",
"@types/jest": "^26.0.24",
"@types/morgan": "^1.9.2", "@types/morgan": "^1.9.2",
"@types/passport": "^1.0.6", "@types/passport": "^1.0.6",
"jest": "^27.0.6",
"nodemon": "^2.0.9", "nodemon": "^2.0.9",
"ts-jest": "^27.0.3",
"ts-node": "^10.0.0", "ts-node": "^10.0.0",
"typescript": "^4.3.5" "typescript": "^4.3.5"
} }
......
{ {
"exclude": ["node_modules", "__test", "jest.config.js"],
"compilerOptions": { "compilerOptions": {
"target": "es6", "target": "es6",
"module": "commonjs", "module": "commonjs",
"rootDir": "./", "strict": true,
"outDir": "./built", "outDir": "./built",
"rootDir": "./",
"esModuleInterop": true, "esModuleInterop": true,
"strict": true,
"allowJs": true "allowJs": true
} }
} }
\ 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