Skip to content

Commit 80cfa07

Browse files
nabi-noorclaude
andcommitted
test(api): fix types in the series limit ranking range PUT test
Build the external tile config per display type so it narrows to one member of the tile config union. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent f6c0337 commit 80cfa07

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

‎packages/api/src/routers/external-api/v2/utils/__tests__/dashboards.test.ts‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -498,23 +498,24 @@ describe('convertToExternalDashboard orphan-ref heal', () => {
498498
function writeRankingRange(
499499
seriesLimitRankingRange: 'recent' | 'full' | undefined,
500500
): unknown {
501-
const externalDisplayType =
502-
displayType === DisplayType.StackedBar ? 'stacked_bar' : 'line';
501+
const shared = {
502+
sourceId: new mongoose.Types.ObjectId().toString(),
503+
select: [{ aggFn: 'count' as const, where: '' }],
504+
groupBy: 'ServiceName',
505+
seriesLimit: 5,
506+
seriesLimitRankingRange,
507+
};
503508
const internal = convertToInternalTileConfig({
504509
id: 'ranking-range-tile',
505510
x: 0,
506511
y: 0,
507512
w: 12,
508513
h: 4,
509514
name: 'Ranking range tile',
510-
config: {
511-
displayType: externalDisplayType,
512-
sourceId: new mongoose.Types.ObjectId().toString(),
513-
select: [{ aggFn: 'count', where: '' }],
514-
groupBy: 'ServiceName',
515-
seriesLimit: 5,
516-
seriesLimitRankingRange,
517-
},
515+
config:
516+
displayType === DisplayType.StackedBar
517+
? { ...shared, displayType: 'stacked_bar' as const }
518+
: { ...shared, displayType: 'line' as const },
518519
});
519520
if (!isBuilderSavedChartConfig(internal.config)) {
520521
throw new Error('Expected a builder config for a time chart tile');

0 commit comments

Comments
 (0)