Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use isDecimalPercentage in tests for [GithubTopLanguage GitlabTopLanguage] #10752

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions services/github/github-top-language.tester.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import Joi from 'joi'
import { createServiceTester } from '../tester.js'
import { isDecimalPercentage } from '../test-validators.js'

export const t = await createServiceTester()

t.create('top language')
.get('/badges/shields.json')
.expectBadge({
label: 'javascript',
message: Joi.string().regex(/^([1-9]?[0-9]\.[0-9]|100\.0)%$/),
})
t.create('top language').get('/badges/shields.json').expectBadge({
label: 'javascript',
message: isDecimalPercentage,
})

t.create('top language (empty repo)')
.get('/pyvesb/emptyrepo.json')
Expand Down
12 changes: 5 additions & 7 deletions services/gitlab/gitlab-top-language.tester.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import Joi from 'joi'
import { createServiceTester } from '../tester.js'
import { isDecimalPercentage } from '../test-validators.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 Repository').get('/wireshark/wireshark.json').expectBadge({
label: 'c',
message: isDecimalPercentage,
})

t.create('Valid Blank Repo')
.get('/KoruptTinker/gitlab-blank-repo.json')
Expand Down
Loading