-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathlandscape-data.test.ts
More file actions
115 lines (99 loc) · 3.35 KB
/
Copy pathlandscape-data.test.ts
File metadata and controls
115 lines (99 loc) · 3.35 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import { describe, expect, it } from 'vitest'
import {
buildVendorMatrix,
compareVendorMatrixRowsByProducts,
LANDSCAPE_PRODUCT_CATEGORIES,
type LandscapeProduct,
type ProductCategory,
type VendorMatrixRow,
} from '@/lib/landscape-data'
function createRow(name: string, categories: ProductCategory[]): VendorMatrixRow {
const cells: VendorMatrixRow['cells'] = {
ide: [],
extension: [],
cli: [],
desktop: [],
model: [],
provider: [],
}
for (const category of categories) {
const product: LandscapeProduct = {
id: `${name}-${category}`,
name: `${name} ${category}`,
vendor: name,
category,
description: '',
path: '/',
}
cells[category].push(product)
}
return {
vendorId: name.toLowerCase(),
vendorName: name,
vendorType: 'full-stack',
cells,
}
}
describe('landscape matrix ordering', () => {
it('uses the intended product column order', () => {
expect(LANDSCAPE_PRODUCT_CATEGORIES).toEqual([
'ide',
'extension',
'cli',
'desktop',
'model',
'provider',
])
})
it('places vendors with models before broader vendors without models', () => {
const modelVendor = createRow('Model vendor', ['model'])
const toolVendor = createRow('Tool vendor', ['ide', 'extension', 'cli', 'desktop'])
expect([toolVendor, modelVendor].sort(compareVendorMatrixRowsByProducts)).toEqual([
modelVendor,
toolVendor,
])
})
it('places model-less providers after tool vendors regardless of coverage', () => {
const toolVendor = createRow('Tool vendor', ['ide'])
const providerVendor = createRow('Provider vendor', [
'ide',
'extension',
'cli',
'desktop',
'provider',
])
expect([providerVendor, toolVendor].sort(compareVendorMatrixRowsByProducts)).toEqual([
toolVendor,
providerVendor,
])
})
it('sorts equal model groups by category coverage', () => {
const narrow = createRow('Narrow', ['model'])
const broadZulu = createRow('Zulu', ['model', 'provider', 'cli'])
const broadAlpha = createRow('Alpha', ['model', 'provider', 'ide'])
expect([narrow, broadZulu, broadAlpha].sort(compareVendorMatrixRowsByProducts)).toEqual([
broadAlpha,
broadZulu,
narrow,
])
})
it('uses visible column order to break category coverage ties', () => {
const ideVendor = createRow('Zulu IDE', ['ide'])
const extensionVendor = createRow('Alpha Extension', ['extension'])
const cliVendor = createRow('Bravo CLI', ['cli'])
const desktopVendor = createRow('Charlie Desktop', ['desktop'])
expect(
[desktopVendor, cliVendor, extensionVendor, ideVendor].sort(compareVendorMatrixRowsByProducts)
).toEqual([ideVendor, extensionVendor, cliVendor, desktopVendor])
})
it('uses vendor name after priority, coverage, and column presence are equal', () => {
const zulu = createRow('Zulu', ['model', 'ide'])
const alpha = createRow('Alpha', ['model', 'ide'])
expect([zulu, alpha].sort(compareVendorMatrixRowsByProducts)).toEqual([alpha, zulu])
})
it('propagates entity deprecation status to landscape products', () => {
const google = buildVendorMatrix().find(row => row.vendorId === 'google')
const geminiCli = google?.cells.cli.find(product => product.id === 'gemini-cli')
expect(geminiCli?.deprecated).toBe(true)
})
})