This repository was archived by the owner on May 15, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathexperiments.spec.ts
More file actions
82 lines (73 loc) · 2.58 KB
/
Copy pathexperiments.spec.ts
File metadata and controls
82 lines (73 loc) · 2.58 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
// npx vitest run src/shared/__tests__/experiments.spec.ts
import type { ExperimentId } from "@roo-code/types"
import { EXPERIMENT_IDS, experimentConfigsMap, experiments as Experiments } from "../experiments"
describe("experiments", () => {
describe("PREVENT_FOCUS_DISRUPTION", () => {
it("is configured correctly", () => {
expect(EXPERIMENT_IDS.PREVENT_FOCUS_DISRUPTION).toBe("preventFocusDisruption")
expect(experimentConfigsMap.PREVENT_FOCUS_DISRUPTION).toMatchObject({
enabled: false,
})
})
})
describe("RE_ANCHOR_BEFORE_EDIT", () => {
it("is configured correctly", () => {
expect(EXPERIMENT_IDS.RE_ANCHOR_BEFORE_EDIT).toBe("reAnchorBeforeEdit")
expect(experimentConfigsMap.RE_ANCHOR_BEFORE_EDIT).toMatchObject({
enabled: false,
})
})
it("returns false when not enabled", () => {
const experiments: Record<ExperimentId, boolean> = {
preventFocusDisruption: false,
imageGeneration: false,
runSlashCommand: false,
customTools: false,
reAnchorBeforeEdit: false,
}
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.RE_ANCHOR_BEFORE_EDIT)).toBe(false)
})
it("returns true when enabled", () => {
const experiments: Record<ExperimentId, boolean> = {
preventFocusDisruption: false,
imageGeneration: false,
runSlashCommand: false,
customTools: false,
reAnchorBeforeEdit: true,
}
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.RE_ANCHOR_BEFORE_EDIT)).toBe(true)
})
})
describe("isEnabled", () => {
it("returns false when experiment is not enabled", () => {
const experiments: Record<ExperimentId, boolean> = {
preventFocusDisruption: false,
imageGeneration: false,
runSlashCommand: false,
customTools: false,
reAnchorBeforeEdit: false,
}
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.PREVENT_FOCUS_DISRUPTION)).toBe(false)
})
it("returns true when experiment is enabled", () => {
const experiments: Record<ExperimentId, boolean> = {
preventFocusDisruption: true,
imageGeneration: false,
runSlashCommand: false,
customTools: false,
reAnchorBeforeEdit: false,
}
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.PREVENT_FOCUS_DISRUPTION)).toBe(true)
})
it("returns false when experiment is not present", () => {
const experiments: Record<ExperimentId, boolean> = {
preventFocusDisruption: false,
imageGeneration: false,
runSlashCommand: false,
customTools: false,
reAnchorBeforeEdit: false,
}
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.PREVENT_FOCUS_DISRUPTION)).toBe(false)
})
})
})