Commit 1b7070f8 authored by Rosanny Sihombing's avatar Rosanny Sihombing Committed by Rosanny Sihombing
Browse files

add unit test (jest)

(cherry picked from commit c8c8abc3)
parent c0e4d9e6
Showing with 9782 additions and 2800 deletions
+9782 -2800
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 source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -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
Supports Markdown
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