-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Expand file tree
/
Copy pathmatrix.test.ts
More file actions
58 lines (49 loc) · 1.94 KB
/
Copy pathmatrix.test.ts
File metadata and controls
58 lines (49 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { buildMatrix } from '../../matrix/build_matrix';
import { renderMatrix } from '../../matrix/render_matrix';
import { parseMatrixConfig } from '../../matrix/load_matrix_config';
import type { AggregatedModelScores } from '../../matrix/query_matrix_scores';
describe('matrix command empty-result guard', () => {
const config = parseMatrixConfig({
columns: [{ id: 'triage', label: 'Triage', suites: ['suite-a'], weight: 1 }],
models: [{ id: 'model-a', label: 'Model A' }],
});
it('renders header-only CSVs when no experiments match', () => {
const rendered = renderMatrix(buildMatrix([], config), config);
expect(rendered.proprietaryCsv.trim().split('\n')).toHaveLength(1);
expect(rendered.openSourceCsv.trim().split('\n')).toHaveLength(1);
});
it('renders populated CSVs when experiments do match', () => {
const aggregated: AggregatedModelScores[] = [
{
modelId: 'model-a',
provider: 'anthropic',
suites: [
{
suiteId: 'suite-a',
experimentId: 'experiment-a',
datasets: [
{
datasetId: 'dataset-a-id',
datasetName: 'dataset-a',
evaluators: [{ evaluatorName: 'correctness', mean: 0.9, count: 10 }],
},
],
},
],
},
];
const rendered = renderMatrix(buildMatrix(aggregated, config), config);
expect(rendered.proprietaryCsv.trim().split('\n').length).toBeGreaterThan(1);
});
it('produces no model rows when no experiments match', () => {
const matrix = buildMatrix([], config);
expect(matrix.proprietary).toHaveLength(0);
expect(matrix.openSource).toHaveLength(0);
});
});