-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90e3762
commit 6a2e25a
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React, { useEffect, useState } from "react"; | ||
|
||
interface GetCoverageJSONProps{ | ||
OS:string | ||
} | ||
const GetCoverageJSON: React.FC<GetCoverageJSONProps> = ({OS}) => { | ||
const [coverage, setCoverage] = useState<number | undefined>(); | ||
const [errorState, setErrorState] = useState<Error | undefined>(); | ||
|
||
useEffect(() => { | ||
const fetchData = async () => { | ||
try { | ||
const data = await fetch( | ||
"https://proud-island-067885010.4.azurestaticapps.net/windowsCoverage.json" | ||
).then((res) => res.json()); | ||
if (!data) { | ||
throw new Error("Invalid response"); | ||
} | ||
setCoverage(data.statementCoverage); | ||
} catch (error) { | ||
setErrorState(error); | ||
} | ||
}; | ||
fetchData(); | ||
}, []); | ||
|
||
if (errorState) { | ||
return ( | ||
<img | ||
src={`https://img.shields.io/badge/Error-fetching-red`} | ||
alt="Test Coverage Badge" | ||
/> | ||
); | ||
} | ||
console.log | ||
return ( | ||
<div> | ||
{coverage && ( | ||
<img | ||
src={`https://img.shields.io/badge/${OS}-${coverage}-darkgreen`} | ||
alt="Test Coverage Badge" | ||
/> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default GetCoverageJSON; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Test Coverage Report | ||
Latest test coverage reports across OS. | ||
It shows the percentage of code covered by various types of tests, including unit tests, component tests, and accessibility tests across chart types. | ||
Go through it to analyze if your code is validated through test automations. | ||
|
||
import GetCoverageJSON from "../apps/docsite/src/components/GetCoverageJSON.tsx" | ||
|
||
| OS | Link | Status | | ||
|----|------|--------| | ||
| Code coverage for Windows | https://proud-island-067885010.4.azurestaticapps.net/windows-latest/index.html | <GetCoverageJSON OS="Windows"/> | | ||
| Code coverage for Ubuntu | https://proud-island-067885010.4.azurestaticapps.net/ubuntu-latest/index.html | <GetCoverageJSON OS="Ubuntu"/> | | ||
| Code coverage for MacOS | https://proud-island-067885010.4.azurestaticapps.net/macos-latest/index.html | <GetCoverageJSON OS="MacOS"/> | |