From fd165bf813d7038fab1f08d6f35e1d87abd47090 Mon Sep 17 00:00:00 2001 From: Yos Riady Date: Thu, 6 Aug 2026 18:45:52 +0700 Subject: [PATCH] Update the charts live test to the summaries-default list contract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The old assertion expected the parent board on a default list; it kept passing only while prod still executed charts on list. With the backend trim deployed, the default is summaries (no board, no query/results) and results=true is the opt-in that carries the board — assert both. Co-Authored-By: Claude Fable 5 --- test/commands/charts.test.ts | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/test/commands/charts.test.ts b/test/commands/charts.test.ts index 3ae246f..765bfc1 100644 --- a/test/commands/charts.test.ts +++ b/test/commands/charts.test.ts @@ -3,7 +3,8 @@ import { listBoardsRun } from '../../src/commands/boards'; import { listChartsRun, getChartRun, createChartRun, updateChartRun } from '../../src/commands/charts'; import { requiresLiveApi } from '../helpers/liveApi'; -// Response shape: PaginatedResponse + { board, warnings? } for list, +// Response shape: PaginatedResponse for list (summaries default; +// with results=true: PaginatedResponse + { board, warnings? }), // Chart for get (bare resource — no envelope). describe('commands/charts', function () { @@ -20,19 +21,35 @@ describe('commands/charts', function () { }); describe('listChartsRun()', function () { - it('returns paginated charts for a board with the parent board', async function () { + it('returns paginated chart summaries by default (no board, no results)', async function () { if (!boardId) return this.skip(); const res = await listChartsRun(boardId) as { - data: { id: string }[]; - board: { id: string }; + data: Record[]; total: number; has_more: boolean; }; expect(res.data).to.be.an('array'); - expect(res.board).to.have.property('id'); + // Summaries: the parent board and per-chart query/results only ship + // with results=true — listing must never silently execute charts. + expect(res).to.not.have.property('board'); expect(res).to.have.property('total'); expect(res).to.have.property('has_more'); - if (res.data.length > 0) firstChartId = res.data[0].id; + for (const row of res.data) { + expect(row).to.not.have.property('query'); + expect(row).to.not.have.property('results'); + } + if (res.data.length > 0) firstChartId = res.data[0].id as string; + }); + + it('returns executed charts with the parent board when results=true', async function () { + if (!boardId) return this.skip(); + this.timeout(30000); // executes every chart query on the board + const res = await listChartsRun(boardId, { size: 2 }, true) as { + data: { id: string }[]; + board: { id: string }; + }; + expect(res.data).to.be.an('array'); + expect(res.board).to.have.property('id'); }); });