refactor: define electric BI metric semantics
This commit is contained in:
@@ -31,8 +31,20 @@ test('publishes hydrogen cost, revenue, and gross profit as separate metrics', (
|
||||
assert.equal(byId.get('hydrogen.customer_order_gross_profit')?.aggregation, 'derived');
|
||||
});
|
||||
|
||||
test('publishes electric fee components and blended cost semantics', () => {
|
||||
const metrics = listMetricDefinitions('electric');
|
||||
const byId = new Map(metrics.map(metric => [metric.id, metric]));
|
||||
|
||||
assert.ok(metrics.length >= 6);
|
||||
assert.equal(byId.get('electric.charge_total_fee')?.formula, 'SUM(fee)');
|
||||
assert.equal(byId.get('electric.electricity_fee')?.formula, 'SUM(e_fee)');
|
||||
assert.equal(byId.get('electric.service_fee')?.formula, 'SUM(service_fee)');
|
||||
assert.equal(byId.get('electric.blended_cost_intensity')?.aggregation, 'weighted-ratio');
|
||||
});
|
||||
|
||||
test('validates only published metric domains', () => {
|
||||
assert.equal(isMetricDomain('mileage'), true);
|
||||
assert.equal(isMetricDomain('hydrogen'), true);
|
||||
assert.equal(isMetricDomain('electric'), true);
|
||||
assert.equal(isMetricDomain('unknown'), false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user