Skip to content

Commit

Permalink
Add buildMetricsSettingsOverrides for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
roseayeon committed Apr 18, 2024
1 parent abb477b commit 3ff7cd2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tensorboard/webapp/metrics/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,27 @@ export function buildMetricsSettingsState(
};
}

// Since Settings proto has missing fields, we need to build a partial of
// Settings to be used in tests.
export function buildMetricsSettingsOverrides(
overrides?: Partial<MetricsSettings>
): Partial<MetricsSettings> {
return {
cardMinWidth: null,
tooltipSort: TooltipSort.NEAREST,
ignoreOutliers: false,
xAxisType: XAxisType.WALL_TIME,
scalarSmoothing: 0.3,
hideEmptyCards: true,
scalarPartitionNonMonotonicX: false,
imageBrightnessInMilli: 123,
imageContrastInMilli: 123,
imageShowActualSize: true,
histogramMode: HistogramMode.OFFSET,
...overrides,
};
}

function buildBlankState(): MetricsState {
return {
tagMetadataLoadState: {
Expand Down

0 comments on commit 3ff7cd2

Please sign in to comment.