Skip to content

Commit

Permalink
lint: code formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
KoolTheba committed Jun 8, 2024
1 parent 7c56551 commit 75a9688
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
42 changes: 33 additions & 9 deletions cypress/e2e/comparator.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,11 @@ describe("Comparator", () => {
.should("contain", "Unchanged")
.and("have.css", "background-color")
.and("eq", "rgb(108, 117, 125)");

cy.get('[data-testid="Binary-Artifacts-score"] > span').should("contain", "0/10");

cy.get('[data-testid="Binary-Artifacts-score"] > span').should(
"contain",
"0/10",
);

cy.get('[data-testid="Branch-Protection"]').should(
"contain",
Expand Down Expand Up @@ -222,7 +225,10 @@ describe("Comparator", () => {
.should("contain", "Unchanged")
.and("have.css", "background-color")
.and("eq", "rgb(108, 117, 125)");
cy.get('[data-testid="Code-Review-score"] > span').should("contain", "0/10");
cy.get('[data-testid="Code-Review-score"] > span').should(
"contain",
"0/10",
);
cy.get('[data-testid="Code-Review"] ~ h4').should(
"contain",
"Additional details / variations",
Expand All @@ -233,7 +239,10 @@ describe("Comparator", () => {
.should("contain", "Unchanged")
.and("have.css", "background-color")
.and("eq", "rgb(108, 117, 125)");
cy.get('[data-testid="Contributors-score"] > span').should("contain", "10/10");
cy.get('[data-testid="Contributors-score"] > span').should(
"contain",
"10/10",
);

cy.get('[data-testid="Dangerous-Workflow"]').should(
"contain",
Expand Down Expand Up @@ -280,14 +289,20 @@ describe("Comparator", () => {
.should("contain", "Unchanged")
.and("have.css", "background-color")
.and("eq", "rgb(108, 117, 125)");
cy.get('[data-testid="Maintained-score"] > span').should("contain", "10/10");
cy.get('[data-testid="Maintained-score"] > span').should(
"contain",
"10/10",
);
cy.get('[data-testid="Maintained"] ~ h4').should(
"contain",
"Additional details / variations",
);

cy.get('[data-testid="Packaging"]').should("contain", "Packaging");
cy.get('[data-testid="Packaging-score"] > abbr > span').should("contain", "?");
cy.get('[data-testid="Packaging-score"] > abbr > span').should(
"contain",
"?",
);

cy.get('[data-testid="Pinned-Dependencies"]').should(
"contain",
Expand Down Expand Up @@ -321,13 +336,19 @@ describe("Comparator", () => {
.should("contain", "Unchanged")
.and("have.css", "background-color")
.and("eq", "rgb(108, 117, 125)");
cy.get('[data-testid="Security-Policy-score"] > span').should("contain", "10/10");
cy.get('[data-testid="Security-Policy-score"] > span').should(
"contain",
"10/10",
);

cy.get('[data-testid="Signed-Releases"]').should(
"contain",
"Signed-Releases",
);
cy.get('[data-testid="Signed-Releases-score"] > abbr > span').should("contain", "?");
cy.get('[data-testid="Signed-Releases-score"] > abbr > span').should(
"contain",
"?",
);

cy.get('[data-testid="Token-Permissions"]').should(
"contain",
Expand All @@ -354,7 +375,10 @@ describe("Comparator", () => {
.should("contain", "Increased 2.7")
.and("have.css", "background-color")
.and("eq", "rgb(24, 135, 84)");
cy.get('[data-testid="Vulnerabilities-score"] > span').should("contain", "10/10");
cy.get('[data-testid="Vulnerabilities-score"] > span').should(
"contain",
"10/10",
);
cy.get('[data-testid="Vulnerabilities"] ~ h4').should(
"contain",
"Additional details / variations",
Expand Down
5 changes: 4 additions & 1 deletion src/components/ProjectComparator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ function ProjectComparator() {
<div data-testid={element.name} className="heading__wrapper">
<div className="info-badge__wrapper">
<h3>{element.name}</h3>
<div data-testid={`${element.name}-score`} className="info-score__wrapper">
<div
data-testid={`${element.name}-score`}
className="info-score__wrapper"
>
{element.score >= 0 ? (
<>
{scoreChecker(element.score, element.prevScore)}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/comparator/scoreChecker.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Badge from "../../components/Badge";

export const scoreChecker = (currentValue: number, previousValue: number) => {
if(currentValue < 0){
if (currentValue < 0) {
currentValue = 0;
}

if (previousValue < 0){
if (previousValue < 0) {
previousValue = 0;
}

Expand Down

0 comments on commit 75a9688

Please sign in to comment.