Skip to content

Commit c53a131

Browse files
cleanup
1 parent 0a508c6 commit c53a131

File tree

2 files changed

+12
-28
lines changed

2 files changed

+12
-28
lines changed

static/app/views/prevent/preventAI/hooks/useUpdatePreventAIFeature.spec.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ describe('useUpdatePreventAIFeature', () => {
2525
test_generation: {
2626
enabled: false,
2727
triggers: {on_command_phrase: false, on_ready_for_review: false},
28+
sensitivity: 'medium',
2829
},
2930
bug_prediction: {
3031
enabled: false,
@@ -45,6 +46,7 @@ describe('useUpdatePreventAIFeature', () => {
4546
test_generation: {
4647
enabled: false,
4748
triggers: {on_command_phrase: false, on_ready_for_review: false},
49+
sensitivity: 'medium',
4850
},
4951
bug_prediction: {
5052
enabled: false,
@@ -191,19 +193,19 @@ describe('useUpdatePreventAIFeature', () => {
191193
expect(feature?.triggers.on_ready_for_review).toBe(true);
192194
});
193195

194-
it('should update sensitivity', () => {
196+
it('should preserve sensitivity', () => {
195197
const config = structuredClone(mockOrg.preventAiConfigGithub!);
196198
const updatedConfig = makePreventAIConfig(config, {
197199
feature: 'bug_prediction',
198-
enabled: true,
200+
enabled: false,
199201
orgName: 'org-1',
200202
repoName: 'repo-xyz',
201-
sensitivity: 'low',
203+
trigger: {on_ready_for_review: true},
202204
});
203205
const feature =
204206
updatedConfig.github_organizations?.['org-1']?.repo_overrides?.['repo-xyz']
205207
?.bug_prediction;
206-
expect(feature?.sensitivity).toBe('low');
208+
expect(feature?.sensitivity).toBe('medium');
207209
});
208210
});
209211
});

static/app/views/prevent/preventAI/manageReposPanel.spec.tsx

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ describe('ManageReposPanel', () => {
3535
bug_prediction: {
3636
enabled: true,
3737
triggers: {on_command_phrase: true, on_ready_for_review: false},
38-
sensitivity: 'medium',
3938
},
4039
test_generation: {
4140
enabled: false,
@@ -44,7 +43,6 @@ describe('ManageReposPanel', () => {
4443
vanilla: {
4544
enabled: true,
4645
triggers: {on_command_phrase: false, on_ready_for_review: false},
47-
sensitivity: 'medium',
4846
},
4947
},
5048
repo_overrides: {},
@@ -71,9 +69,9 @@ describe('ManageReposPanel', () => {
7169

7270
it('shows feature toggles with correct initial state', async () => {
7371
render(<ManageReposPanel {...defaultProps} />, {organization: mockOrganization});
74-
expect(await screen.findByLabelText(/Enable PR Review/i)).toBeChecked();
75-
expect(await screen.findByLabelText(/Enable Test Generation/i)).not.toBeChecked();
76-
expect(await screen.findByLabelText(/Enable Error Prediction/i)).toBeChecked();
72+
expect(await screen.findByLabelText(/PR Review/i)).toBeChecked();
73+
expect(await screen.findByLabelText(/Test Generation/i)).not.toBeChecked();
74+
expect(await screen.findByLabelText(/Error Prediction/i)).toBeChecked();
7775
expect(
7876
await screen.findByLabelText(/Auto Run on Opened Pull Requests/i)
7977
).not.toBeChecked();
@@ -86,9 +84,9 @@ describe('ManageReposPanel', () => {
8684
isLoading: true,
8785
};
8886
render(<ManageReposPanel {...defaultProps} />, {organization: mockOrganization});
89-
expect(await screen.findByLabelText(/Enable PR Review/i)).toBeDisabled();
90-
expect(await screen.findByLabelText(/Enable Test Generation/i)).toBeDisabled();
91-
expect(await screen.findByLabelText(/Enable Error Prediction/i)).toBeDisabled();
87+
expect(await screen.findByLabelText(/PR Review/i)).toBeDisabled();
88+
expect(await screen.findByLabelText(/Test Generation/i)).toBeDisabled();
89+
expect(await screen.findByLabelText(/Error Prediction/i)).toBeDisabled();
9290
});
9391

9492
it('shows error message if updateError is present', async () => {
@@ -101,22 +99,6 @@ describe('ManageReposPanel', () => {
10199
expect(await screen.findByText(/Could not update settings/i)).toBeInTheDocument();
102100
});
103101

104-
it('shows sensitivity options when feature is enabled', async () => {
105-
render(<ManageReposPanel {...defaultProps} />, {organization: mockOrganization});
106-
const prReviewCheckbox = await screen.findByLabelText(/Enable PR Review/i);
107-
const errorPredictionCheckbox = await screen.findByLabelText(
108-
/Enable Error Prediction/i
109-
);
110-
expect(prReviewCheckbox).toBeChecked();
111-
expect(errorPredictionCheckbox).toBeChecked();
112-
expect(
113-
await screen.findByTestId(/pr-review-sensitivity-dropdown/i)
114-
).toBeInTheDocument();
115-
expect(
116-
await screen.findByTestId(/error-prediction-sensitivity-dropdown/i)
117-
).toBeInTheDocument();
118-
});
119-
120102
describe('getRepoConfig', () => {
121103
it('returns repo override config when present', () => {
122104
const orgConfig: PreventAIOrgConfig = {

0 commit comments

Comments
 (0)