Skip to content

Commit

Permalink
Fix lint and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarhussain committed Jan 7, 2025
1 parent 53bbb67 commit 6ee25e3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/utils/extendedTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class ExtendedTable extends CliTable3 {
* Render the table as HTML
*/
toHTML(): string {
let html = "\n<table>\n";
let html = "\n\n<table>\n";

if (this.options.head && this.options.head.length > 0) {
html += "<thead>\n<tr>\n";
Expand Down Expand Up @@ -43,7 +43,7 @@ export class ExtendedTable extends CliTable3 {
html += " </tr>\n";
}
html += "</tbody>\n";
html += "</table>";
html += "</table>\n\n";
return html;
}
}
1 change: 0 additions & 1 deletion src/utils/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export function renderPerformanceTable(
return output === "cli" ? table.toString() : table.toHTML();
}


export function renderBenchmarkComparisonTable(benchComp: BenchmarkComparisonReport, output: "cli" | "html"): string {
const keys = [...benchComp.results.keys()];
const benchmarkSize = benchComp.commitsShas.length;
Expand Down
24 changes: 18 additions & 6 deletions test/unit/utils/extendedTable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ describe("table", () => {
table.push(["Row 1 1", "Row 1 2"]);
table.push(["Row 2 1", "Row 2 2"]);

const html = `<table>
const html = `
<table>
<thead>
<tr>
<th>Col1</th>
Expand All @@ -25,7 +27,9 @@ describe("table", () => {
<td>Row 2 2</td>
</tr>
</tbody>
</table>`;
</table>
`;

expect(table.toHTML().replace(/ /g, "")).toEqual(html.replace(/ /g, ""));
});
Expand All @@ -36,7 +40,9 @@ describe("table", () => {
table.push(["Row 1 1", "Row 1 2"]);
table.push(["Row 2 1", "Row 2 2"]);

const html = `<table>
const html = `
<table>
<tbody>
<tr>
<td>Col1</td>
Expand All @@ -51,7 +57,9 @@ describe("table", () => {
<td>Row 2 2</td>
</tr>
</tbody>
</table>`;
</table>
`;

expect(table.toHTML().replace(/ /g, "")).toEqual(html.replace(/ /g, ""));
});
Expand All @@ -62,7 +70,9 @@ describe("table", () => {
table.push(["Row 1 1", "Row 1 2", "Row 1 3"]);
table.push(["Row 2 1", "Row 2 2", "Row 2 3"]);

const html = `<table>
const html = `
<table>
<tbody>
<tr>
<td colspan="2">Col1</td>
Expand All @@ -79,7 +89,9 @@ describe("table", () => {
<td>Row 2 3</td>
</tr>
</tbody>
</table>`;
</table>
`;

expect(table.toHTML().replace(/^\s+/gm, "")).toEqual(html.replace(/^\s+/gm, ""));
});
Expand Down

0 comments on commit 6ee25e3

Please sign in to comment.