refactor: define hydrogen BI metric semantics
This commit is contained in:
@@ -21,7 +21,18 @@ test('lists mileage metrics without exposing the catalog array', () => {
|
||||
assert.ok(metrics.every(metric => metric.domain === 'mileage'));
|
||||
});
|
||||
|
||||
test('publishes hydrogen cost, revenue, and gross profit as separate metrics', () => {
|
||||
const metrics = listMetricDefinitions('hydrogen');
|
||||
const byId = new Map(metrics.map(metric => [metric.id, metric]));
|
||||
|
||||
assert.ok(metrics.length >= 8);
|
||||
assert.equal(byId.get('hydrogen.refuel_cost')?.formula, "SUM(cost_total) WHERE del_flag = '0'");
|
||||
assert.equal(byId.get('hydrogen.customer_revenue')?.formula, "SUM(fee_total) WHERE del_flag = '0'");
|
||||
assert.equal(byId.get('hydrogen.customer_order_gross_profit')?.aggregation, 'derived');
|
||||
});
|
||||
|
||||
test('validates only published metric domains', () => {
|
||||
assert.equal(isMetricDomain('mileage'), true);
|
||||
assert.equal(isMetricDomain('hydrogen'), true);
|
||||
assert.equal(isMetricDomain('unknown'), false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user