1
0
mirror of https://github.com/badges/shields.git synced 2025-11-22 18:22:43 +03:00

Add [GithubDirectoryFileCount] badge (#5705)

* Added GithubDirectoryFileCount badge

* Additional information on a schema

* Update services/github/github-directory-file-count.service.js

Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>

* Update services/github/github-directory-file-count.service.js

Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>

* Update services/github/github-directory-file-count.service.js

Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>

* More examples

* Moved isArray check to transform method

* Using isMetric for validation

* Added documentaion on type and extension parameters

* Moved a couple of service tests to unit tests

* extension is applicable for type file only

* Note on GitHub API limit

* Using metric helper for a count formatting

Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
Hubert Jagodziński
2020-10-18 16:30:15 +02:00
committed by GitHub
parent 10ddd866da
commit 7a19dc40ef
3 changed files with 256 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
'use strict'
const { isMetric } = require('../test-validators')
const t = (module.exports = require('../tester').createServiceTester())
t.create('directory file count').get('/badges/shields.json').expectBadge({
label: 'files',
message: isMetric,
})
t.create('directory file count (custom path)')
.get('/badges/shields/services.json')
.expectBadge({
label: 'files',
message: isMetric,
})
t.create('directory file count (directory not found)')
.get('/badges/shields/not_existing_directory.json')
.expectBadge({
label: 'files',
message: 'repo or directory not found',
})
t.create('directory file count (not a directory)')
.get('/badges/shields/package.json.json')
.expectBadge({
label: 'files',
message: 'not a directory',
})