Skip to content

Commit

Permalink
Add: Test cases + Rename service
Browse files Browse the repository at this point in the history
  • Loading branch information
KoruptTinker committed Dec 18, 2024
1 parent fe57aae commit b0e0fcb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const queryParamSchema = Joi.object({
gitlab_url: optionalUrl,
}).required()

export default class GitlabLanguage extends GitLabBase {
export default class GitlabTopLanguage extends GitLabBase {
static category = 'analysis'

static route = {
Expand Down Expand Up @@ -59,7 +59,6 @@ export default class GitlabLanguage extends GitLabBase {
color: 'blue',
}
}
// Get max value from here
}

async fetch({ project, baseUrl }) {
Expand Down
25 changes: 25 additions & 0 deletions services/gitlab/gitlab-top-language.tester.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Joi from 'joi'
import { createServiceTester } from '../tester.js'

export const t = await createServiceTester()

t.create('Valid Repository')
.get('/wireshark/wireshark.json')
.expectBadge({
label: 'c',
message: Joi.string().regex(/^([1-9]?[0-9]\.[0-9]|100\.0)%$/),
})

t.create('Valid Blank Repo')
.get('/KoruptTinker/gitlab_blank_repo.json')
.expectBadge({
label: 'no languages found',
message: 'NA',
})

t.create('Invalid Repository')
.get('/wireshark/invalidexample.json')
.expectBadge({
label: 'language',
message: 'project not found',
})

0 comments on commit b0e0fcb

Please sign in to comment.