"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const filter_1 = require("../types/filter");
const savedCharts_1 = require("../types/savedCharts");
const chartValidation_1 = require("./chartValidation");
describe('getUnusedTableCalculations', () => {
    it('does not mark table calculations used by table calculation filters as unused', () => {
        const result = (0, chartValidation_1.getUnusedTableCalculations)({
            chartType: savedCharts_1.ChartType.CARTESIAN,
            chartConfig: {
                layout: {
                    xField: 'orders_created_week',
                    yField: ['running_total'],
                },
                eChartsConfig: {},
            },
            queryTableCalculations: ['running_total', 'after_date'],
            tableCalculationFilters: {
                id: 'table-calculation-filters',
                and: [
                    {
                        id: 'after-date-filter',
                        target: { fieldId: 'after_date' },
                        operator: filter_1.FilterOperator.EQUALS,
                        values: [true],
                    },
                ],
            },
        });
        expect(result.unusedTableCalculations).toEqual([]);
    });
    it('marks table calculations unused when they are not on axes or in filters', () => {
        const result = (0, chartValidation_1.getUnusedTableCalculations)({
            chartType: savedCharts_1.ChartType.CARTESIAN,
            chartConfig: {
                layout: {
                    xField: 'orders_created_week',
                    yField: ['running_total'],
                },
                eChartsConfig: {},
            },
            queryTableCalculations: ['running_total', 'helper_calc'],
        });
        expect(result.unusedTableCalculations).toEqual(['helper_calc']);
    });
});
//# sourceMappingURL=chartValidation.test.js.map