diff --git a/src/reporters/github/github.test.ts b/src/reporters/github/github.test.ts index bf24c2d..3d8d31f 100644 --- a/src/reporters/github/github.test.ts +++ b/src/reporters/github/github.test.ts @@ -247,6 +247,36 @@ describe("buildViewModel", () => { expect(output).toContain("cost 42 · no index suggestion"); }); + test("renders multiple new queries as separate list items (#158)", () => { + const ctx = makeContext({ + comparison: makeComparison({ + newQueries: [ + { + hash: "new-sessions", + query: 'SELECT "id" FROM "sessions"', + formattedQuery: 'SELECT "id" FROM "sessions"', + nudges: [], tags: [], tableReferences: [], + optimization: { state: "no_improvement_found", cost: 1, indexesUsed: ["sessions_pkey"] }, + }, + { + hash: "new-item-watches", + query: 'SELECT "id" FROM "item_watches"', + formattedQuery: 'SELECT "id" FROM "item_watches"', + nudges: [], tags: [], tableReferences: [], + optimization: { state: "no_improvement_found", cost: 1, indexesUsed: ["item_watches_pkey"] }, + }, + ], + }), + }); + const output = renderTemplate(ctx); + // trimBlocks strips the newline after a trailing block tag, which used to + // glue consecutive bullets together (`… no index suggestion- SELECT …`). + expect(output).not.toMatch(/no index suggestion-\s*/); + expect(output).toContain( + 'no index suggestion\n- SELECT "id" FROM "item_watches"', + ); + }); + test("regressions surface in displayRegressed", () => { const ctx = makeContext({ comparison: makeComparison({ diff --git a/src/reporters/github/success.md.j2 b/src/reporters/github/success.md.j2 index ec6f755..ee979b7 100644 --- a/src/reporters/github/success.md.j2 +++ b/src/reporters/github/success.md.j2 @@ -83,7 +83,7 @@ {% for q in displayNewQueries %} {% set link = queryLinks[q.hash] %} -- {% if link %}[{{ q.queryPreview }}]({{ link }}){% else %}{{ q.queryPreview }}{% endif %}{% if q.costLabel %}
{{ q.costLabel }} · no index suggestion{% endif %} +- {% if link %}[{{ q.queryPreview }}]({{ link }}){% else %}{{ q.queryPreview }}{% endif %}{% if q.costLabel %}
{{ q.costLabel }} · no index suggestion{% endif %}{{""}} {% endfor %} {% endif %}