"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const field_1 = require("../types/field");
const lightdashModelConverter_1 = require("./lightdashModelConverter");
describe('convertLightdashModelToDbtModel', () => {
    it('preserves pre-aggregates in model meta', () => {
        const model = {
            type: 'model',
            name: 'orders',
            sql_from: 'jaffle.orders',
            dimensions: [
                {
                    name: 'order_date',
                    type: field_1.DimensionType.DATE,
                    sql: '${TABLE}.order_date',
                },
            ],
            pre_aggregates: [
                {
                    name: 'orders_rollup',
                    dimensions: ['order_date'],
                    metrics: ['order_count'],
                    materialization_role: {
                        email: 'materialize@acme.com',
                        attributes: {
                            allowed_regions: ['EMEA'],
                        },
                    },
                },
            ],
        };
        const dbtModel = (0, lightdashModelConverter_1.convertLightdashModelToDbtModel)(model);
        expect(dbtModel.meta.pre_aggregates).toEqual(model.pre_aggregates);
        expect(dbtModel.config?.meta?.pre_aggregates).toEqual(model.pre_aggregates);
    });
});
//# sourceMappingURL=lightdashModelConverter.test.js.map