diff --git a/README.md b/README.md index 8c816ad..80303e5 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ | Statements | Branches | Functions | Lines | | --------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| ![Statements](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | ![Branches](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | ![Functions](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | ![Lines](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | +| ![Statements](https://img.shields.io/badge/statements-100%25-brightgreen.svg) | ![Branches](https://img.shields.io/badge/branches-100%25-brightgreen.svg) | ![Functions](https://img.shields.io/badge/functions-100%25-brightgreen.svg) | ![Lines](https://img.shields.io/badge/lines-100%25-brightgreen.svg) | --- diff --git a/src/constants.ts b/src/constants.ts index c288519..824d1f0 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -8,5 +8,5 @@ export const hashesConst = { { key: 'statements', value: 'Statements' }, ], }; -export const coverageUrlConst = (coverage: number, color: string): string => - `https://img.shields.io/badge/Coverage-${coverage}${encodeURI('%')}-${color}.svg`; +export const coverageUrlConst = (alt: string, coverage: number, color: string): string => + `https://img.shields.io/badge/${alt}-${coverage}${encodeURI('%')}-${color}.svg`; diff --git a/src/editor.ts b/src/editor.ts index a8447a2..6accf6a 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -46,7 +46,7 @@ export const getCoverageBadge = (coverageFile: string, hashKey: string): string const coverage: number = parsedCoverage.total[hashKey].pct; const color = getCoverageColor(coverage); - return coverageUrlConst(coverage, color); + return coverageUrlConst(hashKey, coverage, color); } catch { return false; } diff --git a/tests/editor.spec.ts b/tests/editor.spec.ts index 844882b..550dc3c 100644 --- a/tests/editor.spec.ts +++ b/tests/editor.spec.ts @@ -39,7 +39,7 @@ describe('Tests editor', () => { const brokenJsonCoverageBadges = getCoverageBadge(brokenJsonCoverageFile, 'nonExistingHash'); const wrongJsonCoverageBadges = getCoverageBadge('wrong json', 'nonExistingHash'); - expect(existingCoverageBadge).toEqual('https://img.shields.io/badge/Coverage-95.45%25-brightgreen.svg'); + expect(existingCoverageBadge).toEqual('https://img.shields.io/badge/bad-95.45%25-brightgreen.svg'); expect(nonExistingCoverageBadges).toBeFalsy(); expect(brokenJsonCoverageBadges).toBeFalsy(); expect(wrongJsonCoverageBadges).toBeFalsy(); diff --git a/tests/helpers.spec.ts b/tests/helpers.spec.ts index 2344630..3510b16 100644 --- a/tests/helpers.spec.ts +++ b/tests/helpers.spec.ts @@ -1,4 +1,4 @@ -import { getCoveragePath, getReadmePath, readFileAsync } from "../src/helpers"; +import { getCoveragePath, getReadmePath, readFileAsync } from '../src/helpers'; describe('test helpers file', () => { it('should getCoveragePath from arguments', () => { @@ -19,7 +19,7 @@ describe('test helpers file', () => { process.argv.pop(); }); - it ('should fail to read an async file', async () => { - await readFileAsync('./foo/bar.biz', 'utf-8').catch(e => expect(e).toEqual('file not found: ./foo/bar.biz')) - }) -}) \ No newline at end of file + it('should fail to read an async file', async () => { + await readFileAsync('./foo/bar.biz', 'utf-8').catch((e) => expect(e).toEqual('file not found: ./foo/bar.biz')); + }); +});