Skip to content

Commit

Permalink
Changed the tabe heading
Browse files Browse the repository at this point in the history
  • Loading branch information
nbhoski committed Jun 21, 2024
1 parent d6835b8 commit b88efb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/buildSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function readJsonFile(filePath: string): Promise<TaskList> {
}

export function getBuildSummaryTable(tasks: TaskList): string[][] {
const header: string[] = ['Task Name', 'Status', 'Description', 'Duration (HH:MM:SS)'];
const header: string[] = ['MATLAB Build Task', 'Status', 'Description', 'Duration (HH:MM:SS)'];
let taskSummaryTableRows: string[][] = [header];

tasks.taskDetails.forEach((task, index) => {
Expand All @@ -41,7 +41,7 @@ export function getBuildSummaryTable(tasks: TaskList): string[][] {
} else if (task.skipped) {
taskDetails.push('🔵 SKIPPED');
} else {
taskDetails.push('🟢 PASSED');
taskDetails.push('🟢 SUCCESS');
}
taskDetails.push(task.description);
taskDetails.push(task.duration);
Expand All @@ -54,7 +54,6 @@ export function getBuildSummaryTable(tasks: TaskList): string[][] {

export function writeSummary(taskSummaryTableRows: string[][]) {
core.summary
.addHeading('MATLAB Build Results')
.addTable(taskSummaryTableRows)
.write();
}
Expand Down
7 changes: 2 additions & 5 deletions src/buildSummary.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('summaryGeneration', () => {
};

const expectedTable = [
['Task Name', 'Status', 'Description', 'Duration (HH:MM:SS)'],
['MATLAB Build Task', 'Status', 'Description', 'Duration (HH:MM:SS)'],
['Test Task', '🔴 FAILED', 'A test task', '00:00:10'],
];

Expand All @@ -32,15 +32,12 @@ describe('summaryGeneration', () => {

it('writes the summary correctly', () => {
const mockTableRows = [
['Task Name', 'Status', 'Description', 'Duration (HH:MM:SS)'],
['MATLAB Build Task', 'Status', 'Description', 'Duration (HH:MM:SS)'],
['Test Task', '🔴 FAILED', 'A test task', '00:00:10'],
];

buildSummary.writeSummary(mockTableRows);

expect(core.summary.addHeading).toHaveBeenCalledTimes(1);
expect(core.summary.addHeading).toHaveBeenCalledWith('MATLAB Build Results');

expect(core.summary.addTable).toHaveBeenCalledTimes(1);
expect(core.summary.addTable).toHaveBeenCalledWith(mockTableRows);
});
Expand Down

0 comments on commit b88efb6

Please sign in to comment.