Fix tests to not expect default threshold

This commit is contained in:
Kristina Durivage 2024-11-20 12:22:28 -06:00
parent 8503c86275
commit 4e680d91bd
3 changed files with 3 additions and 3 deletions

View File

@ -350,7 +350,7 @@ export function setFieldConfigDefaults(config: FieldConfig, defaults: FieldConfi
// if we have a base threshold set by default but not on the config, we need to merge it in
const defaultBaseStep =
defaults.thresholds?.mode === ThresholdsMode.Absolute &&
defaults?.thresholds?.mode === ThresholdsMode.Absolute &&
defaults.thresholds?.steps.find((step) => step.value === -Infinity);
if (
config.thresholds?.mode === ThresholdsMode.Absolute &&

View File

@ -93,7 +93,7 @@ describe('config from data', () => {
const results = extractConfigFromQuery(options, [config, seriesA]);
expect(results.length).toBe(1);
const thresholdConfig = results[0].fields[1].config.thresholds?.steps[1];
const thresholdConfig = results[0].fields[1].config.thresholds?.steps[0];
expect(thresholdConfig).toBeDefined();
expect(thresholdConfig?.color).toBe('orange');
expect(thresholdConfig?.value).toBe(50);

View File

@ -111,7 +111,7 @@ describe('Rows to fields', () => {
});
const result = rowsToFields({}, input);
expect(result.fields[0].config.thresholds?.steps[1].value).toBe(30);
expect(result.fields[0].config.thresholds?.steps[0].value).toBe(30);
});
it('Will extract other string fields to labels', () => {