Skip to content

Commit

Permalink
feat: output specs
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsenta committed Sep 8, 2023
1 parent a5c5db2 commit e517e8f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions aggregate-into-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ delete metadata[TestMetadata]; // Extract TestMetadata which is a special case
// generate groups: an array of {group, key} objects
// where group is the group name (or undefined), and key is the test key name (or undefined)
// It represents the table leftmost column.
//
//
// Group1
// Group1 - Test1
// Group1 - Test2
Expand Down Expand Up @@ -69,19 +69,27 @@ groups.sort((a, b) => {
// generate a table
const columns = [];

// add the leading column ("gateway", "version", "key1", "key2", ... "keyN")
// add the leading column ("gateway", "version", "group1", "test11", ... "test42")
const leading = ["gateway", "version"];
groups.forEach(({ group, key }) => {
if (key === undefined) {
leading.push(`**${group || 'Other'}**`);
return;
}

const m = metadata[key];

// Skip the "Test" prefix
let niceKey = key.replace(/^Test/, '');

const m = metadata[key];
if (m.specs && m.specs.length > 0) {
if (m.specs.length === 1) {
niceKey = `[${niceKey}](https://${m.specs[0]})`
} else {
const urls = m.specs.map((url, index) => `[${index}](https://${url})`);
niceKey = `${niceKey} (${urls.join(', ')})`;
}
}

leading.push(niceKey);
});
columns.push(leading);
Expand Down

0 comments on commit e517e8f

Please sign in to comment.