Skip to content

Commit

Permalink
use isDecimalPercentage in tests for github/lab top lang (#10752)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris48s authored Dec 31, 2024
1 parent b4c21fd commit 7108e08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
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

0 comments on commit 7108e08

Please sign in to comment.